Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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);
target
The target paletted texture that is to have its palette changed. Must be TEXTURE_1D or TEXTURE_2D.
start
The starting palette index entry of the palette to be changed.
count
The number of palette index entries of the palette to be changed beginning at start. The count parameter determines the range of palette index entries that are changed.
format
The format of the pixel data. The following symbolic constants are accepted:
Constant | Description |
---|---|
GL_RGBA | Each pixel is a group of four components in the following order: red, green, blue, alpha. The RGBA format is determined in this way:
|
GL_RED | Each pixel is a single red component.
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. |
GL_GREEN | Each pixel is a single green component.
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. |
GL_BLUE | Each pixel is a single blue component.
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. |
GL_ALPHA | Each pixel is a single alpha component.
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. |
GL_RGB | Each pixel is a group of three components in this order: red, green, blue.
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 | Each pixel is a group of three components in this order: blue, green, red.
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 | Each pixel is a group of four components in this order: blue, green, red, alpha.
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. |
type
The data type for data. The following symbolic constants are accepted: GL_UNSIGNED_BYTE, GL_BYTE, GL_UNSIGNED_SHORT, GL_SHORT, GL_UNSIGNED_INT, GL_INT, and GL_FLOAT.
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 |
data
A pointer to the paletted texture data. The data is treated as single pixels of a 1-D texture palette entry for a palette entry.
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. |
** Windows NT/2000:** Requires Windows NT 4.0 or later.
** Windows 95/98:** Requires Windows 95 or later. Available as a redistributable for Windows 95.
** Header:** Declared in Gl.h.
** Library:** Use Opengl32.lib.
glBegin, glColorTableEXT, glEnd, glGetColorTableEXT, glGetColorTableParameterfvEXT, glGetColorTableParameterivEXT, glGetString, wglGetProcAddress
Please sign in to use this experience.
Sign in