Problems With Alpha on Targa Files
"With my feet upon the ground I lose myself between the sounds and open wide to suck it in, I feel it move across my skin. I''m reaching up and reaching out. I''m reaching for the random or what ever will bewilder me, what ever will bewilder me. And following our will and wind we may just go where no one''s been. We''ll ride the spiral to the end and may just go where no one''s been." - Maynard James Keenan [TheBlackJester ]
[Wildfire Studios ]
Well, if I change the alpha values of the quad that a normal bmp texture is on, it changes the entire texture. For example, if I set it to 0.0f, the quad along with the bmp texture on it become completely invisible. However, if I do the same thing with a targa file, the targa texture doesn''t change. Even if the alpha value of the quad is 0.0f, the quad is completely visible. I want to be able to lower and raise the alpha value of the texture on my quad by changing the 4th value of a call to glColo4f(); I.e., fade the texture in and out with for loops.
Thats odd that it works with a BMP and not a TGA. First, make sure that you have your blending enabled. Then, set the blend func to (GL_SRC_ALPHA, GL_ONE). I can''t really think of much more that would be causing it unless I saw some source..
Well, hope that helps
"With my feet upon the ground I lose myself between the sounds and open wide to suck it in, I feel it move across my skin. I''m reaching up and reaching out. I''m reaching for the random or what ever will bewilder me, what ever will bewilder me. And following our will and wind we may just go where no one''s been. We''ll ride the spiral to the end and may just go where no one''s been." - Maynard James Keenan [TheBlackJester ]
[Wildfire Studios ]
glBindTexture(GL_TEXTURE_2D, tex[HUD]);
unsigned char* pixels = NULL;
pixels = tga.GetPixels();
glTexImage2D(GL_TEXTURE_2D, 0, 4, tga.GetImageWidth(),
tga.GetImageHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
Here is how I bind my bitmaps:
glBindTexture(GL_TEXTURE_2D, tex[Sun]);
gltAutoMipmapBMP("Sun.BMP", GL_LINEAR_MIPMAP_LINEAR, GL_REPEAT);
The following lines are where I''m having trouble:
glBindTexture(GL_TEXTURE_2D, tex[HUD]);
glColor4f(1.0f, 1.0f, 1.0f, 0.5f);
I use this just before drawing the quad, and setting the texcoords. If I bind the Sun texture object instead of the HUD, the call to glColor4f() will show the texture with half it''s original opacity. However, when I use the HUD texture object, (which already has some parts that are clear because of the alpha values in the .tga file), it looks like the original image. No parts of the texture are faded any more so than they already were in the original image. Even if I set the 4th parameter of the call to glColor4f to 0.0f, so that the quad and texture would be completely invisible, the targa HUD picture is still completely visible. Do you know if there is some other way to manipulate those values? Or do you think it may have something to do with the way that I''m handling the targa-based texture?
Thanks again for all of your help.