Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: rendering trees

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2001
    Location
    Castellon, Spain
    Posts
    7

    rendering trees

    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

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    3,115

    Re: rendering trees

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •