PDA

View Full Version : Depth testing without updating Z buffer



marcus256
11-28-2001, 04:21 AM
Is there a way to use the contents of the depth buffer without updating it? I know it is possible to do the other way around (updating without testing):



glEnable( GL_DEPTH_TEST );
glDepthFunc( GL_ALWAYS );

The code snippet above writes to the z-buffer without testing for the contents of the z-buffer, but I want to enable testing and disable writing.

I know I can solve this with a stencil buffer, but it seems like an incredible overkill since the information is there anyhow (in the Z-buffer and from my fragment).



[This message has been edited by marcus256 (edited 11-28-2001).]

styx
11-28-2001, 04:41 AM
glDepthMask(GL_FALSE)
disables writing
glDepthMask(GL_TRUE)
anables it.

--styx

marcus256
11-28-2001, 04:45 AM
THANKS! I knew I had seen it somewhere, but when I went through the OpenGL 1.3 spec I could not find it (at least not in the dpeth buffer test section).