PDA

View Full Version : Dithering textures



BramThijssen
02-18-2005, 01:10 PM
I'm trying to convert some of my 32 bit textures to 16 bit (RGBA4 - I need the alpha) to save memory, but the problem is that it makes them look really awful. I figured dithering them would help a lot, so my question is how do I dither textures? I also have 32 bit textures, and the environment is 32 bit, so simply calling glEnable(GL_DITHER) doesn't do the trick. Is there a way to let glTexImage2D() do dithering?

Thanks,
Bram

ZbuffeR
02-18-2005, 03:06 PM
No simple way to do it with opengl I think.
Oh, yes : create a full screen 16 bit opengl window, draw your 32 bit texture with GL_DITHER enabled, then glReadPixels the rendered image, and store that new texture for later use.

Anyway, this is more a pre-processing step, better do it offline with dedicated tools (Photoshop etc) or search for a floyd-steinberg dithering or whatever.
http://twomix.devolution.com/pipermail/sdl/2001-July/037002.html

-NiCo-
02-19-2005, 03:12 AM
If it's only the memory you're worried about, using compressed textures gives you a better result and compression ratio compared to the 2:1 compression you achieve by going from 32 to 16 bit.

Nico