I made a mistake it’s
GL_ONE_MINUS_SRC_ALPHA, and not the other way around.
I enable depth testing by calling glEnable(DEPTH_TEST);
I’m posting the part where I turn blending on and off:
// make depth buffer read only
// define the blend function
// enable blending
// draw all transparent objects
// disable blending
// enable depth testing
Since this piece of code is inside a loop (refreshing the scene at regular intervals), I have to make sure that depth testing is enabled and the Depth buffer is writable the next time the loop is kicked off.
I am surprised why GL_ONE_MINUS_SRC_ALPHA doesn’t work?
However, if I let the depth buffer enabled, and turn blending on for my entire scene, it starts working!!!
I’ve looked at what the red book says about this and it has an example which uses glBlendFunc(GL_SRC_ALPHA, GL_ONE), which works in my program, but the transparent objects are really transparent, and the alpha value of my transaparent objects doesn’t have any effect! Is it because the destination alpha (of the opaque objects) is 1? If so, why does it work with blending turned on for all objects?
I’d appreciate any help, 'coz I can’t think of an explaination!