stencil-buffer

Concave polygon drawing

For drawing complex concave polygons with OpenGL, is it better to tesselate it into triangles, or use the stencil buffer? I'm guessing the stencil buffer would be faster for a single frame, but triangulation would be better for multiple frames if the polygon doesn't change. However, I haven't actually tried it, so I don't know. ...

Does OpenGL stencil test happen before or after fragment program runs?

When I set glStencilFunc( GL_NEVER, . . . ) effectively disabling all drawing, and then run my [shader-bound] program I get no performance increase over letting the fragment shader run. I thought the stencil test happened before the fragment program. Is that not the case, or at least not guaranteed? Replacing the fragment shader with one...

OpenGl: Stencil buffer problem (Wall + Window)?!

Hey all, I want to create a wall with a window inside, using stencil buffer. My code looks like this: glEnable(GL_STENCIL_TEST); glClearStencil(0); glClear(GL_STENCIL_BUFFER_BIT); glStencilMask(1); glStencilFunc(GL_ALWAYS, 1, 1); glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); glDisable(GL_DEPTH_TEST); glColor3f(1,1,1); //Window g...

Getting the OpenGL-ES Stencil Buffer Working

With the stencil buffer in opengl-es for Android, I'm simply trying to mask out drawing part of the screen. I think I have it set up right, but it is not masking out the non-stenciled parts. Below is an extraction of code for what I'm doing. gl.glEnable(GL10.GL_STENCIL_TEST); gl.glClearStencil(0); gl.glClear(GL10.GL_STENCIL_BUFFER_BIT);...

Not able to get stencil to work

Was trying to get Stencil to work in my app. I use Sprites to render content on to the Device. Content could be movies, pictures or text. Can I set the stencil buffer using these Sprites, which can be used in later passes to stencil out other Sprites being rendered? I'm even not able to stencil out any of the Sprites by setting Stencil...

OpenGL stencil buffer OR operation?

I'm not sure if this is possible to do, but it's worth a shot. I'm using the stencil buffer to reduce overdraw for light volumes in a deferred renderer using this algorithm (when the camera is outside the volume): Using a cheap shader, draw back faces with depth testing set to LEQUAL, marking them in the stencil buffer. Using the expen...