Stencil and Depth Test


I’m trying to make a 3D selection using the z-buffer, but for that I need to use the stencil buffer so the scene doesn’ t change.

The problem is that when stencil test fails the depth test it’s not even done.
There is any way to make the depht test even when the stencil test fails?


Daniel Tost

If you want to use the stencil buffer to prevent pixel from being drawn on the screen (as in, the user won’t see what’s going on), then just use double buffering and render to the back buffer instead. The back buffer is not visible until you swap the front an back buffers.