Stencil Test

From OpenGL Wiki
Revision as of 17:05, 12 January 2015 by Alfonse (talk | contribs) (Section on the stencil buffer.)
Jump to navigation Jump to search

The Stencil Test is a per-sample operation performed after the Fragment Shader. The fragment's stencil value is tested against the value in the current stencil buffer; if the test fails, the fragment is culled.

Stencil buffer

In order to use the stencil test, the current Framebuffer must have a stencil buffer. The stencil buffer is an image that uses a stencil image format. The Default Framebuffer may have a stencil buffer, and user-defined framebuffers can attach stencil formatted images (either depth/stencil or stencil-only) to the GL_STENCIL_ATTACHMENT attachment point.