PDA

View Full Version : rendering trees



Mar
03-29-2001, 07:09 AM
Hello!
I would like render a tree, where the leaves are quads with a texture on them.
This texture has an alpha chanel, and using

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

i make one part of the leave transparent. But it doesn´t run very well. I suposse
I have to order the quads from back to front for drawing.
But is there other possibility ? Maybe to use opacity maps?

Thanks for your help in advance

Bob
03-29-2001, 07:30 AM
You can use alpha test instead of blending. with glAlphaFunc you can reject pixels with alpha value below/above a certain value. In your case, you might want to reject pixels with alpha lower than, say, 0.5. This technique does not involve blending, which can be bad for performance. And no back to front sorting is needed, just draw them as you store them. The result can be, in some cases be as good as blending, but usually there is a slight drop in visual quality, but hey, you can gain speed.