The glColorSubTableEXT function specifies a portion of the targeted texture's palette to be replaced.
void glColorSubTableEXT(
GLenum target,
GLsizei start,
GLsizei count,
GLenum format,
GLenum type,
const GLvoid * data
);
1.The glColorSubTableEXT function converts floating-point values directly to an internal format with unspecified precision. Signed integer values are mapped linearly to the internal format such that the most positive representable integer value maps to 1.0, and the most negative representable value maps to – 1.0. Unsigned integer data is mapped similarly: the largest integer value maps to 1.0, and zero maps to 0.0.
2.The glColorSubTableEXT function multiplies the resulting color values by GL_c_SCALE and adds them to GL_c_BIAS, where c is RED, GREEN, BLUE, and ALPHA for the respective color components. The results are clamped to the range [0,1].
3.If GL_MAP_COLOR is TRUE, glColorSubTableEXT scales each color component by the size of lookup table GL_PIXEL_MAP_c_TO_c, then replaces the component by the value that it references in that table; c is R, G, B, or A, respectively.
4.The glColorSubTableEXT function converts the resulting RGBA colors to fragments by attaching the current raster position z-coordinate and texture coordinates to each pixel, then assigning x and y window coordinates to the nth fragment such that
x (n) = x (r) + n mod width
y (n) = y (r) + ë n/width û
where (x (r) , y (r) ) is the current raster position.
5.These pixel fragments are then treated just like the fragments generated by rasterizing points, lines, or polygons. The glColorSubTableEXT function applies texture mapping, fog, and all the fragment operations before writing the fragments to the frame buffer.
The glColorSubTableEXT function converts this component to the internal format in the same way that the red component of an RGBA pixel is, then converts it to an RGBA pixel with green and blue set to 0.0, and alpha set to 1.0. After this conversion, the pixel is treated just as if it had been read as an RGBA pixel.
The glColorSubTableEXT function converts this component to the internal format in the same way that the green component of an RGBA pixel is, and then converts it to an RGBA pixel with red and blue set to 0.0, and alpha set to 1.0. After this conversion, the pixel is treated just as if it had been read as an RGBA pixel.
The glColorSubTableEXT function converts this component to the internal format in the same way that the blue component of an RGBA pixel is, and then converts it to an RGBA pixel with red and green set to 0.0, and alpha set to 1.0. After this conversion, the pixel is treated just as if it had been read as an RGBA pixel.
The glColorSubTableEXT function converts this component to the internal format in the same way that the alpha component of an RGBA pixel is, and then converts it to an RGBA pixel with red, green, and blue set to 0.0. After this conversion, the pixel is treated just as if it had been read as an RGBA pixel.
The glColorSubTableEXT function converts each component to the internal format in the same way that the red, green, and blue components of an RGBA pixel are. The color triple is converted to an RGBA pixel with alpha set to 1.0. After this conversion, the pixel is treated just as if it had been read as an RGBA pixel.
GL_BGR_EXT provides a format that matches the memory layout of Windows device-independent bitmaps (DIBs). Thus your applications can use the same data with Win32 function calls and OpenGL pixel function calls.
GL_BGRA_EXT provides a format that matches the memory layout of Windows device-independent bitmaps (DIBs). Thus your applications can use the same data with Win32 function calls and OpenGL pixel function calls.
The following table summarizes the meaning of the valid constants for the type parameter.
Constant | Meaning |
---|---|
GL_UNSIGNED_BYTE | Unsigned 8-bit integer |
GL_BYTE | Signed 8-bit integer |
GL_UNSIGNED_SHORT | Unsigned 16-bit integer |
GL_SHORT | Signed 16-bit integer |
GL_UNSIGNED_INT | Unsigned 32-bit integer |
GL_INT | 32-bit integer |
GL_FLOAT | Single-precision floating-point value |
The glColorSubTableEXT function specifies portions of the current targeted texture's palette to be replaced. Unlike glColorTableEXT, you cannot specify the target parameter to be a proxy texture palette.
Note The glColorSubTableEXT function is an extension function that is not part of the standard OpenGL library but is part of the GL_EXT_paletted_texture extension. To check whether your implementation of OpenGL supports glColorSubTableEXT, call glGetString(GL_EXTENSIONS). If it returns GL_EXT_paletted_texture, glColorSubTableEXT is supported. To obtain the function address of an extension function, call wglGetProcAddress.
The following are the error codes generated and their conditions.
Error Code | Condition |
---|---|
GL_INVALID_VALUE | start or count was an invalid integer. |
GL_INVALID_ENUM | target, format, or type was not an accepted value. |
GL_INVALID_OPERATION | glColorSubTableEXT was called between glBegin and glEnd pairs. |
glBegin, glColorTableEXT, glEnd, glGetColorTableEXT, glGetColorTableParameterfvEXT, glGetColorTableParameterivEXT, glGetString, wglGetProcAddress