PDA

View Full Version : Trouble with alpha channels in textures.



wourder
02-01-2004, 04:16 AM
What are the flags that I have to enable to make my program able to read the alpha channel of bitmaps? I've tryed so many techniques but they don't work or they don't produce the results I expected.

jwatte
02-01-2004, 10:27 AM
Make sure you upload the texture using an alpha internal format (like GL_RGBA), and of course specify it using an alpha external format (such as GL_BGRA/GL_UNSIGNED_BYTE).

Then, just use the alpha in the pipeline as you want to. glEnable(GL_ALPHA_TEST) for alpha test, glTexEnvi() to set a texture environment function to something like GL_DECAL, or glEnable(GL_BLEND)/glBlendFunc(GL_SRC_ALPHA,
GL_ONE_MINUS_SRC_ALPHA).

I think you might get better answers on the beginner's board, where this thread should have been, though.