
Can't get the stencil buffer to work
Posted Friday, 9 April, 2010 - 20:37 by Polidobj inI can't seem to get anything working with the Stencil Buffer. I even tried porting the simple example here:
http://www.opengl.org/resources/code/samples/glut_examples/examples/sten...
from this page:
http://www.opengl.org/resources/code/samples/glut_examples/examples/exam...
But all I get is black.
I've made sure I've defined to use 8 bpp for the stencil buffer in the graphics mode.
I'm using a NVIDIA Quadro FX 570.
Any ideas?


Comments
Re: Can't get the stencil buffer to work
Try running the "Stencil CSG" sample in Examples->OpenGL. You should see a sphere "carving out" part of the capsule shape. If that works, then this is likely an application bug.
Can't really give any more advice without seeing some code but you can use the source code for the Stencil CSG sample as a guide.
Re: Can't get the stencil buffer to work
The sample works ok.
The relevant pieces of code:
Creating the control:
In the load event for the control:
When Drawing:
On resize:
Re: Can't get the stencil buffer to work
Friday afternoons suck for getting work done.
With some fresh eyes I found my problems:
I'm using my call to Ortho instead of the what's in the example:
GL.Ortho(-5.0, 5.0, -5.0, 5.0, -5.0, 5.0);And I missed a problem with my porting of the code.
glColor3ub(0, 0, 200);I needed to change the 200. So the call should become:
GL.Color3(0, 0, 0.784);Now to tinker some more with how this thing works.