How can I write only to the stencil buffer in OpenGL ES 2.0?

Posted by stephelton on Game Development See other posts from Game Development or by stephelton
Published on 2011-11-17T22:10:06Z Indexed on 2011/11/18 2:04 UTC
Read the original article Hit count: 550

Filed under:
|
|
|

I'd like to write to the stencil buffer without incurring the cost of my expensive shaders. As I understand it, I write to the stencil buffer as a 'side effect' of rendering something. In this first pass where I write to the stencil buffer, I don't want to write anything to the color or depth buffer, and I definitely don't want to run through my lighting equations in my shaders.

Do I need to create no-op shaders for this (and can I just discard fragments), or is there a better way to do this?

As the title says, I'm using OpenGL ES 2.0.

I haven't used the stencil buffer before, so if I seem to be misunderstanding something, feel free to be verbose.

© Game Development or respective owner

Related posts about opengl

Related posts about glsl