table of contents
GLCOPYCOLORTABLE(3G) | OpenGL Manual | GLCOPYCOLORTABLE(3G) |
NAME¶
glCopyColorTable - copy pixels into a color table
C SPECIFICATION¶
void glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
PARAMETERS¶
target
internalformat
x
y
width
DESCRIPTION¶
glCopyColorTable loads a color table with pixels from the current GL_READ_BUFFER (rather than from main memory, as is the case for glColorTable()).
The screen-aligned pixel rectangle with lower-left corner at (x,\ y) having width width and height 1 is loaded into the color table. If any pixels within this region are outside the window that is associated with the GL context, the values obtained for those pixels are undefined.
The pixels in the rectangle are processed just as if glReadPixels() were called, with internalformat set to RGBA, but processing stops after the final conversion to RGBA.
The four scale parameters and the four bias parameters that are defined for the table are then used to scale and bias the R, G, B, and A components of each pixel. The scale and bias parameters are set by calling glColorTableParameter().
Next, the R, G, B, and A values are clamped to the range 0 1. Each pixel is then converted to the internal format specified by internalformat. This conversion simply maps the component values of the pixel (R, G, B, and A) to the values included in the internal format (red, green, blue, alpha, luminance, and intensity). The mapping is as follows:
Internal Format | Red | Green | Blue | Alpha | Luminance | Intensity |
GL_ALPHA | A | |||||
GL_LUMINANCE | R | |||||
GL_LUMINANCE_ALPHA | A | R | ||||
GL_INTENSITY | R | |||||
GL_RGB | R | G | B | |||
GL_RGBA | R | G | B | A |
Finally, the red, green, blue, alpha, luminance, and/or intensity components of the resulting pixels are stored in the color table. They form a one-dimensional table with indices in the range 0 width - 1.
NOTES¶
glCopyColorTable is available only if ARB_imaging is returned from calling glGetString() with an argument of GL_EXTENSIONS.
ERRORS¶
GL_INVALID_ENUM is generated when target is not one of the allowable values.
GL_INVALID_VALUE is generated if width is less than zero.
GL_INVALID_VALUE is generated if internalformat is not one of the allowable values.
GL_TABLE_TOO_LARGE is generated if the requested color table is too large to be supported by the implementation.
GL_INVALID_OPERATION is generated if glCopyColorTable is executed between the execution of glBegin() and the corresponding execution of glEnd().
ASSOCIATED GETS¶
glGetColorTable(), glGetColorTableParameter()
SEE ALSO¶
glColorTable(), glColorTableParameter(), glReadPixels()
COPYRIGHT¶
Copyright © 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/.
AUTHORS¶
opengl.org
05/02/2014 | opengl.org |