View Full Version : alpha blending problem

09-28-2006, 11:09 PM
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

09-29-2006, 12:26 AM
I disable depth test and drawThis 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

09-29-2006, 03:29 AM
Now don't draw anything ...

09-29-2006, 04:17 AM
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.

09-29-2006, 05:47 AM
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...