As stated, in the unlucky case when you hardware implementation lacks the support for paletted texture, you have to keep a copy of the indexed texture in RAM, and at each frame:

For a faster performance you can do the two step togheter, without having to explicitly build the Shade Table in RAM. Here is an example of how to load the Index Map replacing each texel with the corresponding entry in Shade Table


// ShadeTable.R(G B A), of type float*, is the Red (Green Blue Alpha) component of the shade table. Each entry ranges in [0.0 .. 1.0].
// ShadeTable.size must be a power of 2.

glPixelMapfv( GL_PIXEL_MAP_I_TO_R, ShadeTable.size, ShadeTable.R );
glPixelMapfv( GL_PIXEL_MAP_I_TO_G, ShadeTable.size, ShadeTable.G );
glPixelMapfv( GL_PIXEL_MAP_I_TO_B, ShadeTable.size, ShadeTable.B );
glPixelMapfv( GL_PIXEL_MAP_I_TO_A, ShadeTable.size, ShadeTable.A );

glTexImage2D(
GL_TEXTURE_2D,
0,
4,
texture_size_X,
texture_size_Y,
border,
GL_COLOR_INDEX ,
index_type,
IndexMap
// Target
// Detail level
// Number of components (R,G,B,A)


// just 0 is ok

// index_type can be GL_UNSIGNED_BYTE or GL_UNSIGNED_SHORT
// IndexMap is defined as (unsigned short)* or (unsigned char)*
);