PDA

View Full Version : Transparent textures



fatquack
07-13-2008, 05:53 AM
How do I use textures that have some transparency so i can see whats behind the shape with the texture as oppose to just seing the background color.

Jan
07-13-2008, 07:43 AM
Store a mask in the alpha-channel of your texture and use the alpha-test:

glEnable (GL_ALPHA_TEST);
glAlphaFunc (GL_GREATER, 0.1f);

Now all parts that are "black" in your mask will be discarded, making them see-through, everything that is "white" will be rendered.

You can also use blending, if you want smooth edges. Check out some tutorials, there is plenty of them about this feature.

Jan.