Next | Prev | Up | Top | Contents | Index
Using Texture Color Tables
To use a texture color table, define a color table, as described in "The Color Table Extension". Use GL_TEXTURE_COLOR_TABLE_SGI as the value for the target parameter of the various commands, keeping in mind the following points:
- The table size, specified by the width parameter of glColorTableSGI(), is limited to powers of two.
- The maximum table size is 256 entries.
- Use GL_PROXY_TEXTURE_COLOR_TABLE_SGI to find out whether there is enough room for the texture color table in exactly the manner described in "The Texture Extension Proxy Mechanism".
The following code fragment loads a table that inverts a texture. It uses a GL_LUMINANCE external format table to make identical R, G, and B mappings.
loadinversetable()
{
static unsigned char table[256];
int i;
for (i = 0; i < 256; i++) {
table[i] = 255-i;
}
glColorTableSGI(GL_TEXTURE_COLOR_TABLE_SGI, GL_RGBA8_EXT,
256, GL_LUMINANCE, GL_UNSIGNED_BYTE, table);
glEnable(GL_TEXTURE_COLOR_TABLE_SGI);
}
Next | Prev | Up | Top | Contents | Index