PDA

View Full Version : Z Buffer with transparencies.



TriangleMan
04-08-2004, 09:43 AM
Lets say I have a GL_QUAD, with a texture pasted onto it. This texture is of a circle.
The parts of the texture outside the circle have alpha of 0. Inside have alpha of 1.

So, in normal view, it looks like a circle, not a quad.

What happens in the zbuffer?
Does alpha have anything to do with it?

I am imagining not, and that I would get the full quad. Is this right?

dorbie
04-08-2004, 10:34 AM
You will normally get the full quad written to the zbuffer but you can stop this by culling fragments using alpha test to produce a circle instead.

Use:

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

You can mess around with the values used by the alpha test to suit your circumstances.