Results 1 to 3 of 3

Thread: Problem with blending

  1. #1
    Member Newbie
    Join Date
    Mar 2011
    Posts
    41

    Problem with blending

    I have a dataset which i put into a 3d texture using GL_LUMINANCE_ALPHA, where the luminance is the value of the data and the alpha value is just 0 for 0 and 255 for everything else. I map this to 3 quads as seen in this screenshot http://b.imagehost.org/view/0649/screen1.png

    However the blending is only correct for the last drawn quad. I use
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    Is there anything simple i have overlooked?

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Problem with blending

    Yes, a couple of things

    - depth testing
    - your blendfunc is order dependant. So you have to carefully order the drawing of your quad, ie. for back to front.

    If you only have binary alpha, you can get away with alpha blending and use only alpha testing, and no need to sort your quads in that case.

    glAlphaFunc(GL_GREATER,0.5f); // adjust your prefered threshold here
    glEnable(GL_ALPHA_TEST);

    Some litterature on the subject, I recommend you read at least "Introduction to GPU Volume Rendering" (1) and (2) :
    http://www.vis.uni-stuttgart.de/vis03_tutorial/

    This is somewhat older :
    http://www.cs.utah.edu/~jmk/sigg_crs...rses_0067.html

    The keywords for your searches : hardware accelerated volume rendering.

    There has already been quite a lot of discussions about it on these forums as well.

  3. #3
    Member Newbie
    Join Date
    Mar 2011
    Posts
    41

    Re: Problem with blending

    Quote Originally Posted by ZbuffeR
    If you only have binary alpha, you can get away with alpha blending and use only alpha testing, and no need to sort your quads in that case.

    glAlphaFunc(GL_GREATER,0.5f); // adjust your prefered threshold here
    glEnable(GL_ALPHA_TEST);
    That did the trick, thanks alot. Also thanks for the reading suggestions.

Similar Threads

  1. Blending problem
    By imported_JoshKlint in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 07-06-2009, 09:39 AM
  2. blending problem
    By 0stress in forum OpenGL ES
    Replies: 3
    Last Post: 09-21-2006, 03:36 PM
  3. I problem with blending HELP ME PLEASE!
    By Dol AI with 3D Bone system in forum OpenGL: Basic Coding
    Replies: 12
    Last Post: 10-14-2004, 07:40 AM
  4. Is this a blending problem?
    By in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 08-04-2003, 07:53 AM
  5. Blending problem
    By Imotiep in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-19-2001, 01:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean