PDA

View Full Version : Palettted 8bt textures...Part 2



bmcclint
08-27-2001, 11:03 AM
Is there really no examples or anyone doing this?

I've been hunting the web for about a week now and this backs up a question I asked earlier. Displaying 8bit paletted textures from a color index table. Where I'm at is I have hundreds of premade MIPs in this format, and yeah converting them is easy enough, I kinda want to know how to do his. Odds are I'll probably not implement it as a real usage it's knowledge I'd like to gain?

For what I gathered so far I need to...
Load the color table...either glColorTable() or glColorTableEXT()
Enable ColorIndex mode
Load texture to gl with giTexImage2D(Not sure what parameters to use)

Am I close? Can anyone offer suggestions/examples?

Thanks

ffish
08-28-2001, 03:50 AM
These two lines replace one line:


glColorTable(GL_TEXTURE_3D, GL_LUMINANCE8_ALPHA8, 256, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, lookup);
glTexImage3D(GL_TEXTURE_3D, 0, GL_COLOR_INDEX8_EXT, image_width, image_height, image_depth,
0, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, image);

// Replaces this:
glTexImage3D(GL_TEXTURE_3D, 0, GL_LUMINANCE8_ALPHA8, image_width, image_height, image_depth,
0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, image);
First I loaded the color table (not shown), then did this switch. You don't need to switch to color index mode. This format should work for you as well (obviously change to glTexImage2D).

Hope that helps.