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

Thread: alpha blending problem

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2006
    Posts
    6

    alpha blending problem

    Hi
    I have a problem with alpha blending.
    I disable depth test and draw a solid cube and a solid sphere, cube is semi transparent, the sphere is opaque.
    When the sphere is in front of the cube is semi transparent too. Why?
    The blend function is SRC_ALPHA, ONE_MINUS_SRC_ALPHA .
    Thank a lot

  2. #2
    Senior Member OpenGL Pro k_szczech's Avatar
    Join Date
    Feb 2006
    Location
    Poland
    Posts
    1,119

    Re: alpha blending problem

    I disable depth test and draw
    This is your answer. You don't use depth test so the sphere is always drawn on top of the cube.

    Typical approach look like this:
    -draw all solid objets with depth test ENABLED and depth mask set to TRUE
    -draw all objects that use blending with depth test ENABLED and depth mask set to FALSE

  3. #3
    Guest

    Re: alpha blending problem

    Now don't draw anything ...

  4. #4
    Senior Member OpenGL Pro k_szczech's Avatar
    Join Date
    Feb 2006
    Location
    Poland
    Posts
    1,119

    Re: alpha blending problem

    What's your depth test function (glDepthFunc)?
    Do you have z-buffer (what's your pixelformat)?
    Do you clear z-buffer?
    If it's not any of the above han perhaps you should post some of your code.

  5. #5
    Guest

    Re: alpha blending problem

    I have a depth buffer, i use DepthTest(GL_LESS)
    I use clear Depth buffer and clear color but i don't think for this...

Posting Permissions

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