Use full 8 bits of TGA's alpha channel?

What I’m looking to do is make a texture with the same levels of transparency that I save my TGA files with. They have 8 bits of transparency, but all I’ve been able to get is Transparent or Not Transparent when I load them as textures and draw using Alpha Testing. I was wondering if there was some way to use the full 8 bits of alpha information in the TGA file for smooth blending?

So if I had a black square with 255 alpha on the right side faded to 0 alpha on the left, it would appear a continuous blend rather than half black, half not, like a glAlphaFunc of GL_GREATER, 0.5 would do.

Sounds like instead of alpha testing, you want alpha blending. Try this:


Yup, that was what I was looking for!

Thing is though, I already had that… It’s just that I accidentally had blending and alpha testing enabled, so alpha testing took precedence. Your reply helped me figure that out. I also wasn’t sure exactly how blending worked with texture alpha channels because I knew you could specify alpha with a glColor4f call… I’m guessing this could be used as an additional factor in blending? Like the texture alpha value and the color4f alpha value are multiplied? Well, thanks, your post certainly helped me resolve a longstanding confusion I’ve had (and finally got around to looking into).

[This message has been edited by rhmazza (edited 10-17-2002).]

Yes, you can use the primary color (that is glColor4f) as a secondary factor. Use the texture environment function GL_MODULATE, and the primary color and texture color will be multiplied.