PDA

View Full Version : using 8 bit images and rendering with different palettes?



Jernej
08-28-2004, 10:02 AM
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.

08-28-2004, 10:21 AM
Just convert your 8bit image into a 24bit image using each palette, and upload to Opengl the 24bit textures.

Jernej
08-28-2004, 10:35 AM
are you crazy? i want to use this as memory
optimization feature!

08-28-2004, 01:24 PM
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 ?

arekkusu
08-28-2004, 01:33 PM
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 :(