using 8 bit images and rendering with different palettes?

hi, what do i need in opengl to render 8 bit
images - with different palettes, for instance i want to in same frame render the bitmap which is
from 8-bit palette index data several times on
different places with different palette.

help will be greatly appreciated.

Just convert your 8bit image into a 24bit image using each palette, and upload to Opengl the 24bit textures.

are you crazy? i want to use this as memory
optimization feature!

Well, excuse me, I am not, I am just answering your question, within the context you provided…

If you need memory optimization, then search docs about GL_EXT_paletted_texture if it is supported on your hardware :
http://personal.redestb.es/jmovill/opengl/openglonwin-20.html
http://oss.sgi.com/projects/ogl-sample/registry/EXT/paletted_texture.txt

If not, go for fragment programs (pixel shaders) to do the color lookup, or else use compressed textures.

Did it helped ?

Unfortunately, paletted textures are not widely supported (i.e. not on any ATI cards) and deprecated on the cards that do support them (i.e. removed from recent nvidia drivers.)

There was a thread on this forum a while ago explaining some of the hardware-level reasons for this, but personally I think it is really stupid that indexed texture colorization during rasterization was never put into the core.

If you’ve got fragment programs, you can implement the lookup yourself, but of course this limits your hardware support pretty severely.

Or you can repeatedly do the mapping during texture upload and conversion to 24bpp, but this is really slow.

Or you can build your own cache system of colorized 24bpp textures, but this eats a ton of VRAM.

There’s really no good solution :frowning: