Drawing with stencil test - GL_NOTEQUAL/GL_EQUAL i
I am trying to test a method to cap a clipped object using the stencil buffer.
I learned this method with this page (source code inside) :
When I draw my clip plane using the stencil test I do not understand the results :
1- using the test glStencilFunc(GL_NOTEQUAL, 1, 1) : it is ok. My plane has a hole where the object (a sphere) is clipped.
2- using the test glStencilFunc(GL_EQUAL, 1, 1) : it is not ok : the hole is drawn but also another object is drawn too (a sphere behind the clip plane).
I join images (my scene and the results).
"1-" means that my stencil buffer contains 1 only in a circle. But 2- means something different. This only by inverting the stencil test...
As I am a real beginner I think that I did something wrong or that I do not understand the results.
Could you help me ?
Thanks in advance.