Stencil Test: Difference between revisions

From OpenGL Wiki
Jump to navigation Jump to search
Pipeline page link.
Section on the stencil buffer.
Line 3: Line 3:


{{stub}}
{{stub}}
== 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 [[Framebuffer Object|user-defined framebuffers]] can attach stencil formatted images (either [[Image_Format#Depth_stencil_formats|depth/stencil]] or [[Image_Format#Stencil_only|stencil-only]]) to the GL_STENCIL_ATTACHMENT attachment point.


[[Category:Sample Writing]]
[[Category:Sample Writing]]

Revision as of 17:05, 12 January 2015

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.