GLCOPYCOLORTABLESGI(3gl)GLCOPYCOLORTABLESGI(3gl)NAME
glCopyColorTableSGI - copy pixels into a color table
C SPECIFICATION
void glCopyColorTableSGI( GLenum target,
GLenum internalformat,
GLint x,
GLint y,
GLsizei width)
PARAMETERS
target The color table target. Must be GL_TEXTURE_COLOR_TA‐
BLE_SGI or GL_COLOR_TABLE_SGI.
internalformat The internal storage format of the color table. Must
be one of the following symbolic constants: GL_ALPHA,
GL_ALPHA4, GL_ALPHA8, GL_ALPHA12, GL_ALPHA16, GL_LUMI‐
NANCE, GL_LUMINANCE4, GL_LUMINANCE8, GL_LUMINANCE12,
GL_LUMINANCE16, GL_LUMINANCE_ALPHA, GL_LUMI‐
NANCE4_ALPHA4, GL_LUMINANCE6_ALPHA2, GL_LUMI‐
NANCE8_ALPHA8, GL_LUMINANCE12_ALPHA4, GL_LUMI‐
NANCE12_ALPHA12, GL_LUMINANCE16_ALPHA16, GL_INTENSITY,
GL_INTENSITY4, GL_INTENSITY8, GL_INTENSITY12, GL_INTEN‐
SITY16, GL_RGB, GL_RGB4, GL_RGB5, GL_RGB8, GL_RGB10,
GL_RGB12, GL_RGB16, GL_RGBA, GL_RGBA2, GL_RGBA4,
GL_RGB5_A1, GL_RGBA8, GL_RGB10_A2, GL_RGBA12,
GL_RGBA16.
x The x coordinate of the lower-left corner of the pixel
rectangle to be transferred to the color table.
y The y coordinate of the lower-left corner of the pixel
rectangle to be transferred to the color table.
width The width of the pixel rectangle.
DESCRIPTION
glCopyColorTableSGI loads a color table with pixels from the current
GL_READ_BUFFER (rather than from main memory, as is the case for glCol‐
orTableSGI).
The screen-aligned pixel rectangle with lower-left corner at (x,y) hav‐
ing 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 unde‐
fined.
The pixels in the rectangle are processed just as if glReadPixels were
called, with format 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 compo‐
nents of each pixel. Use glColorTableParameterSGI to specify the scale
and bias parameters for color tables.
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 internal‐
format. 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 fol‐
lows:
┌────────────────────────────────────────────────────────────────────────────────┐
│Base Stored values │
│Internal Format Red Green Blue Alpha Luminance Intensity │
├────────────────────────────────────────────────────────────────────────────────┤
│GL_ALPHA A │
│GL_LUMINANCE R │
│GL_LUMINANCE_ALPHA A R │
│GL_INTENSITY_EXT R │
│GL_RGB R G B │
│GL_RGBA R G B A │
└────────────────────────────────────────────────────────────────────────────────┘
The base internal format is derived from the user specified internal
formats as follows: All resolutions of a particular internal format,
for example GL_ALPHA4, GL_ALPHA8, GL_ALPHA12, GL_ALPHA, GL_ALPHA16 are
of base internal format GL_ALPHA. Similarly, all resolutions of inter‐
nal format GL_LUMINANCE are of base internal format GL_LUMINANCE. All
resolutions of GL_INTENSITY are of base format GL_INTENSITY. All reso‐
lutions of GL_LUMINANCE_ALPHA are of base format GL_LUMINANCE_ALPHA.
All resolutions of GL_RGB are of base format GL_RGB and all resolutions
of GL_RGBA are of base format GL_RGBA.
Finally, the red, green, blue, alpha, luminance, and/or intensity com‐
ponents 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
glCopyColorTableSGI with target GL_COLOR_TABLE_SGI is only available if
GL_SGI_color_table extension is supported.
glCopyColorTableSGI with target GL_TEXTURE_COLOR_TABLE_SGI is only
available if GL_SGI_texture_color_table extension is supported.
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_EXT is generated if the requested color table is too
large to be supported by the implementation.
GL_INVALID_OPERATION is generated if glCopyColorTableSGI is executed
between the execution of glBegin and the corresponding execution of
glEnd.
ASSOCIATED GETS
glGetColorTableParameterSGI
SEE ALSO
glColorTableSGI, glColorTableParameterSGI, glReadPixels
15 Mar 97 GLCOPYCOLORTABLESGI(3gl)