Disable z-buufer writes

How do you disable z-buffer writes and still have the z-buffer enabled?

I know this is a simple question but I can’t seem to find the information, is it possible?

Thank Mike

glDepthMask(GL_FALSE) will disable depth writes.
glDisable(GL_DEPTH_TEST) will disable depth writes and depth testing.

This function call glDepthMask(GL_FALSE) dosen’t seem to work on my TNT 2.

GL_DEPTH_TEST is enabled for the whole program. I draw my scene with depth writes enabled then I disable depth writes and draw the blended flares. I get horribe errors all over the screen, before without disabling z-buffer writes it worked but the first drawn flare could stop the later drawn flares behind it from being seen (because z-buffer stops it). I could sort them in depth order but can’t understand why this dosen’t work.

Thank Mike

Just fixed the problem.

First thing I did was clear the screen and the z-buffer afterwards enabling depth writes. So it was disabled when the operation clear buffers was started.

DOH!!

Mike