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 3 of 3

Thread: OpenGL ES Texture Transparency

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2011
    Location
    Florida
    Posts
    5

    OpenGL ES Texture Transparency

    I'm working on learning OpenGL ES to expand my iPhone development capabilities, but I'm running into some problems with transparent textures that I can't seem to figure out through Google.

    Here are some pics:
    http://www.fullofepicwin.com/randomFiles/IMG_0785.PNG
    http://www.fullofepicwin.com/randomFiles/IMG_0786.PNG

    I'm using this blend function:
    glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);

    The object in the front seems to work exactly the way I want, but the other three objects are acting much differently.

    As you can see, the transparency of the small circle only seems to work when it is over the small D-Pad square, of which no transparency can be seen. This seems really strange as all objects are creating in exactly the same way, but are being displayed differently.

    Thanks in advance for your help, I could surely use it
    Platform: iOS
    API: OpenGL ES 1.1
    OpenGL Experience: Total n00b
    <www.patrickcossette.com>

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Mar 2009
    Location
    Singapore
    Posts
    801

    Re: OpenGL ES Texture Transparency

    Hi,
    Try the basic belnd eq. but also make sure that u render them in back to front order.
    Code :
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    Regards,
    Mobeen

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2011
    Location
    Florida
    Posts
    5

    Re: OpenGL ES Texture Transparency

    That certainly did fix the problem, the strange behavior was indeed due to the order in which I drew my objects, thanks a lot for the help! This also helps me to understand how transparency actually works, by taking each transparent pixel and using the selected blend function to mix it with whatever is in the buffer at that moment.

    Thanks again! You'll probably be seeing a lot of posts from me in the future, I promise to return the favor once I know what I'm doing :P
    Platform: iOS
    API: OpenGL ES 1.1
    OpenGL Experience: Total n00b
    <www.patrickcossette.com>

Posting Permissions

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