glDepthMask(GL_FALSE) on Geforce2 GTS

Hello,

when I call =>

glDepthMask(GL_FALSE);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

depth buffer is not clearing properly (or isn’t clearing at all).
But in spec about glClear(), there is written:

"The pixel-ownership test, the scissor test, dithering, and the buffer writemasks affect 	

the operation of glClear. The scissor box bounds the cleared region. The alpha function,

blend function, logical operation, stenciling, texture mapping, and z-buffering are ignored by

glClear."

This is not problem for my, I can just enable depth masking before glClear, but I am curious
if this is correct behavior or error in drivers.

I have tested it on Detonator 6.5 and 10.80. My card is Inno3D Geforce2 GTS 64Mb, Windows 2000 SP1.

If you want, I can try it on Radeon, Riva TNT…

PS: I have uploaded demo in http://www.abc.sk/OpenGL/Matrox_DepthMasking.zip
In file matrox.cpp on line 223 you can enable/disable depth masking and see this effect.

Marek

You said it yourself:
“The pixel-ownership test, the scissor test, dithering, and the buffer writemasks affect the operation of glClear. The scissor box bounds the cleared region. The alpha function, blend function, logical operation, stenciling, texture mapping, and z-buffering are ignored by glClear.”

So, if the buffer writemasks affect glClear, then of course you won’t clear the z-buffer if you disable writing to it.
glDepthMask(GL_FALSE) will disable writes to the z-buffer, therefore you won’t clear it with your glClear.