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

Thread: glBlendFunc problem

  1. #1
    Intern Contributor
    Join Date
    Sep 2006
    Location
    US(California)
    Posts
    58

    glBlendFunc problem

    I understand from many tutorials that GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA is the best blend function.
    (which makes perfect sense, 1a-1a = 0a)

    Anyway, all blend functions seem to work as their documentation says they should except that one. When I use that one it doesn't use the alpha channel.(replaces it with black)

    Is there any common reason for this problem?

    This is mainly for particles & HUD elements.
    -Josh

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    May 2005
    Location
    Prague, Czech Republic
    Posts
    924

    Re: glBlendFunc problem

    Originally posted by darkrappey:

    Anyway, all blend functions seem to work as their documentation says they should except that one. When I use that one it doesn't use the alpha channel.(replaces it with black)
    Are you sure that your shader or texture environment setup generates nonzero alpha? This blending mode is used very often so the driver error is unlikely.

  3. #3
    Intern Contributor
    Join Date
    Sep 2006
    Location
    US(California)
    Posts
    58

    Re: glBlendFunc problem

    I generate textures in this fashion:

    Are you sure that your shader or texture environment setup generates nonzero alpha?
    When I use the other blend functions the alpha of texture definitely effects how the particles are rendering (just not in the way I would like it to).

    -Josh

  4. #4
    Intern Contributor
    Join Date
    Sep 2006
    Location
    US(California)
    Posts
    58

    Re: glBlendFunc problem

    I also just enabled fog again and it seems to mess up the alpha buy making it white at a distance... could this be related or a hole other problem?
    -Josh

  5. #5
    Advanced Member Frequent Contributor
    Join Date
    May 2005
    Location
    Prague, Czech Republic
    Posts
    924

    Re: glBlendFunc problem

    In the 32 bit texture variant you are calling the gluBuild2DMipmaps for three components instead of four so the alpha value is lost and replaced with opaque one.

  6. #6
    Intern Contributor
    Join Date
    Sep 2006
    Location
    US(California)
    Posts
    58

    Re: glBlendFunc problem

    d'Oh, my bad. I didn't even look at the function specification to notice that. Shame on me lol.

    Works now as far as I can tell.

    -thanks once again Komat
    -Josh

Posting Permissions

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