texturing from 8-bbp bitmap with colour tables

This one must have been done 100 times, but I can’t find the answer anywhere.

Using an 8-bit DIB under win32; glDrawPixels uses the colour tables when:

glPixelTransferi ( GL_MAP_COLOR, GL_TRUE );

is set, together with something like:

glPixelMapuiv ( GL_PIXEL_MAP_I_TO_R, pBMData->RColourTable.nItems, pBMData->RColourTable.pMemory );
glPixelMapuiv ( GL_PIXEL_MAP_I_TO_G, pBMData->GColourTable.nItems, pBMData->GColourTable.pMemory );
glPixelMapuiv ( GL_PIXEL_MAP_I_TO_B, pBMData->BColourTable.nItems, pBMData->BColourTable.pMemory );
glPixelMapuiv ( GL_PIXEL_MAP_I_TO_A, pBMData->AColourTable.nItems, pBMData->AColourTable.pMemory );

However glTexImage2D doesn’t seem to - I just get a black texture (no errors reported). Whats happening?

What are your glTexImage2D parameters?

What glTexParameters do you use? Default is mipmapping, set min and mag filter to NEAREST or LINEAR if you haven’t downloaded mipmaps.

Might be a bug in the OpenGL implementation. Whose is it? (glGetString)

If you’re under Windows and glGetString does not say Microsoft, does it work if you select a pixelformat using the GDI generic OpenGL implementation? (Enumerate all pixelformats, look at the dwFlags, and pick one with PFD_GENERIC_FORMAT set.)

Edit: Just read in the PioxelZoom thread that you use MS GDI Generic. Seriously it’s much more fun to program OpenGL if it’s HW accerelated by a graphics board.

Thank you very much for the suggestions - changing the glTexParameters fixed the problem. For some reason:


works with 24/32 bpp maps, but not 8 bit. (Can’t work out why this should be.)

It would be nice to use OpenGL more fully, but the application needs to be useable by J. Bloggs on any PC. Is it fairly easy to request a HW accelerated Pixelformat and default to MS Generic if that fails?