Hi!
I’m going a bit crazy…
My “scene” consist of two vertex buffers, which renders correctly when I render without any stencil test. So I know that there should be nothing wrong with depth/alpha tests etc…
But as soon as I turn on stencil test, it seems only one of the vertex buffers is rendered, i.e. the other one fails the test somehow.
This is my “workflow” so to speak;
-
Enable stencil test, disable depth test.
-
Set depth and color masks to false.
-
Clear the stencil buffer to 0x0.
-
Set the stencilfunc to GL_ALWAYS and use 0x1 as ref. Also set the stencilop to GL_REPLACE (all three tests).
-
Now render two quads to the screen, where I want the stencil buffer to be set to ones.
-
Set stencilfunc to GL_EQUAL, and 0x1 as ref, and this time set stencilop to GL_KEEP (all three tests).
-
Set depth and color masks back to true, and clear depth and color buffers.
-
Now finaly render my two vertex buffers.
The result is that only one of the vertex buffers are rendered, actually the last one rendered. Am I missing something?