View Full Version : Transparent texture mapping???

11-28-2003, 07:19 AM
Hello! I need to do some partially transparent texture mapping for billboarding. I cannot get this thing to work for the life of me. I have a sample program from a book which runs just FINE. But I can't get my own program to work. I used my debugger to check the bit values of the RGBA-modified BYTE array to make sure the alpha bit is set correctly. When I initialize OpenGL, I do use PFD_TYPE_RGBA. My sequence for the transparent texture mapping is:

glEnable(GL_BLEND) ;
glEnable(GL_ALPHA_TEST) ;
glAlphaFunc(GL_GREATER, 0) ;
glBindTexture(...) ;
...and then do the drawing.

Yet when the drawing occurs, the black "transparent" shows up in full color, creating a black rectangular edge.

Interestingly, if I switch the alpha test to (GL_LESS, 1), the ENTIRE quad becomes invisible, even though I have checked the bytes of the texture, and the alpha values vary correctly between 0 and 255 where I want transparency or not.

Any suggestions at this point would be greatly appreciated. I've been working on this for 3 days now. Maybe I'm overlooking something stupidly obvious. Thanks a bunch.

11-28-2003, 01:45 PM
Sounds a lot like your calls to TexImage2D() or TexSubImage2D() are not correct, or you're feeding them incorrect data.

11-29-2003, 06:30 AM
YES! That was the problem. I forgot to change the internal format field on TexImage2D when I switched over from BGR format. DUH! Thanks much. http://www.opengl.org/discussion_boards/ubb/smile.gif