I'm trying to port a DirectX10 piece of code but I failed to use stencil correctly.
Here is my test :
I have a FBO with a depth stencil render buffer attached and stencil test enabled. I clear it to '1' value.
Then I attach color buffers to the FBO and try to draw a simple fullscreen quad just for test, with stencil test func set to GL_GREATER and ref value to '1'. So I expect to have nothing drawn....but all pixels are drawn on the screen...
Could you please help me finding where I'm wrong ?
the code lokks like this :
Code :glClearStencil(1); (...) //create the renderBufferObject, attach to the FBO glStencilMaskSeparate(GL_FRONT_AND_BACK, 0xffffffff); glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT); //want to keep depth glEnable(GL_STENCIL_TEST); glStencilFuncSeparate(GL_FRONT, GL_GREATER, 1, 0xffffffff); glStencilMaskSeparate(GL_FRONT, 0); glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEPP, GL_KEEP); (...) //draw