View Full Version : wrong colors in TGA
07-13-2002, 09:54 AM
i am using tga-textures to map on some objects. works fine, the parts i want to be transparent are so, but some of the colors are wrong.
for example, brown appears blue ....
i "think" the tga is ok, but what else could be wrong? the tga is 24 bit (16bit color and 8 bit alpha). when i save it as 16 bit (15 color, 1 alpha), loading it to OGL completely fails ....
07-13-2002, 10:27 AM
Problems arise with different platform due to the way they store bits, e.g. Little and Big Endian...
So, if you are in a windows machine, when you load your texture you can simply flip the values of red and blue and when you ceate your texture your parameter can stay as GL_RGB.
Now, if you dont flip these values, you colors will be inverted and to fix this you change from GL_RGB to GL_BGR_EXT
I hope this fixes the problem...
About the 16/15 bits, you would have to post some code to see.
You can get my TGA loader from any of my terrain demos at http://126.96.36.199/miguel
If you dont get the latest however, you will get the problem you are facing if yo are loading 32 bits TGAs, for 24 is fine... It is fixed in versions 5 and on.
07-13-2002, 10:43 AM
hmm, thanks for your advice, i downloaded your prog, and did that
gluBuild2DMipmaps( GL_TEXTURE_2D, 3, texture_info->Width, texture_info->Height, GL_BGR_EXT, GL_UNSIGNED_BYTE, texture_info->Texture_bits )
, but it completely skrewed the texture. looks weird ...
any other ideas? somebody??
07-13-2002, 10:55 AM
ahhh, i got it.
it WAS your advice, i just mixed sth up in that gluBuild2DMipmaps-call.
the second param must be 4, not 3 :-)
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.