Blending Opaque and transparent objects

I’m trying to blend opaque and transparent objects in my scene, and I have a NVidia TNT card.
I am drawing my opque objects first then I am using glDepthFunc(GL_FALSE) to make the Depth Buffer read only when I render my transparent objects.
However, only the following depth function seems to work:

glDepthfunc(GL_SRC_ALPHA, GL_ONE);

I tried using GL_SRC_ALPHA_MINUS_ONE for the second parameter, but it simply turns blending off. Also the alpha value of my transparent objects doesn’t have any effect when I use GL_ONE.

What am I doing wrong?

Oops, I meant
glBlendFunc(GL_SRC_ALPHA, GL_ONE);

Taken from OpenGL specs :

Transparency is best implemented using glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) with primitives sorted from farthest to nearest. Note that this transparency calculation does not require the presence of alpha bitplanes in the frame buffer.

Did you REALLY try yo do GL_SRC_ALPHA_MINUS_ONE or was it GL_ONE_MINUS_SRC_ALPHA ???

In case you really used the first one, I am really surprised coz’ I do not even know about a GL extension that defines it… But in case this extension exists, perhaps it is simply not supported by the drivers you have for your TNT…

If you tried the second one and blending turned off, the error is somewhere else and you should post a bit more of your code…

Regards.

Eric

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
glDepthFunc(GL_FALSE);
// define the blend function
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// enable blending
glEnable(GL_BLEND);
// draw all transparent objects
drawTransparentObjects();
// disable blending
glDisable(GL_BLEND);
// enable depth testing
glDepthFunc(GL_TRUE);

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!

Thanks,
Dhiraj.