View Full Version : Colour problem with textures
Hi, I have a problem with texture's colours. I'm using opengl and SDL - SDL_GL_RED_SIZE, SDL_GL_GREEN_SIZE, SDL_GL_BLUE_SIZE set to 5 6 5 and video mode initialized in 16 bit colour depth. The problem is that when I texture an object, texture's colours look bad - there is no smooth colour shading. This seems very confusing because in 16 bit desktop video mode my picture viewer shows colour shading normally. I use GL_RGB and GL_UNSIGNED_BYTE as the "internalFormat" and "type" parameters of glTexImage2D function. In fact I don't clearly understand the "type" parameter of glTexImage2D. Any suggestions on the ugly colour shading?
Thanks for answering me.
03-02-2005, 10:23 AM
You shouldn't take an image viewer as reference how good it should look. Image viewers generally use sophisticated algorithms to reduce bit depth of images, while your graphic card is propably just cutting away the least significant bits of the color.
A possible solution (I haven't tried it myself) might be to manually reduce the bit depth with an image editor, thus producing a special 16 bit texture, and using this instead of the 32 bit original.
But when just blitted the same images look identical to the image viewer preview. When texture mapped they look ugly. I'm restricted to only using 24 and 32 bit images.
03-06-2005, 04:31 AM
Please provide screenshots from both image viewer output and Gl texture. (Alt-PrintScreen under Windows, then paste in image editor to save)
Here is the link: http://synergie.hit.bg/difference.bmp
It's quite big 750Kb saved as a BMP. On the top is what my openGL program shows - it is being initialized in 800x600 orthographic mode where 1 point is 1 pixel. The screenshot is made "AS IS" I have just cut the insignificant parts of my desktop. My desktop is running in 16 bit color depth and openGL initialization is like what I described in my first post message.
Hey, Guys thank you very much for your answers and special thanks to Overmind for his wisdom - the problem is exactly what he said. I solved it like this - first save the picture as R5 G6 B5 BMP and later import the flatten image in my PNG and save it like 24 bit. Thanks again. I must listen more careful your advices.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.