Incorrect texture colors

Started by
8 comments, last by domstyledesign 19 years, 8 months ago
whenever i load a texture (from a .bmp), the colors are off. it seems(?) like the intensities are too high for each component. is this a clamping issue?... do i need to use glPixelStorei?
Advertisement
if you just load a raw bmp file in manually u need to flip the R and B components. BMP's are stored as BGR for some reason.

i know this, it's not the problem.

i don't think(*) it's a problem with my loading class. i made a bmp with an all red circle, an all blue circle, and an all green circle on a black background. the circles load and show up fine.

however, when i try something like this

i get wierd results, as you can see.

this is not a problem with width and height either, other textures load fine, and what's shown here is just a snippet of the full texture. the rest of the image was just reference lines (so i could make sure it wasn't a problem with width/height)

any suggestions?

[Edited by - domstyledesign on August 5, 2004 2:41:29 AM]
your program renders 2xbigger color values than stored in your file, then these values are cut off (probably by the type range) you can see that effect here

it is one of color channels taken from your pic

//i have to learn english - i know :/
Dolphins - The sharks of the sea.
...not sure what that means...

i'm loading a 24bit bmp file, and my data type is GLubyte.
Do you get the correct result if you - before calling glTexImage2d - just divide all the color values by 2?

What's your hardware?
Can you post the rendering and texture setup code?
well yeah, the problem is solved (divide each component by 2), but i don't understand why the problem arises. happybara explained but i don't completely understand...
Quote:Original post by domstyledesign
well yeah, the problem is solved (divide each component by 2), but i don't understand why the problem arises. happybara explained but i don't completely understand...


go through your loader code, check the actual value of a pixel and then check the value you are storing.

well i had the loader write the values of each component of each pixel to a terminal window after reading happybara's post. each number printed ranged from 0 to 255, as it should. since every value is now divided by 2, the range is obviously 0 to 127. unless these values can be of higher precision than an INT, my openGL app isn't running @ 24bit color.


...right?
21-bit color? am i confused...? can someone explain this to me?

This topic is closed to new replies.

Advertisement