GLenum internalformat, GLint x, GLint y, GLsizei width )
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 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 (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].
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.