PDA

View Full Version : transpaency in texture mapping???



xpnctoc
11-28-2003, 10:25 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) ;
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) ;
glEnable(GL_ALPHA_TEST) ;
glAlphaFunc(GL_GREATER, 0) ;
glBindTexture(...) ;
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE) ;
...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.