25 #include "glfStencilBufferMode.hh"
26 #include "glfException.hh"
41 enableTest_ = GL_FALSE;
42 stencilMask_ = numeric_limits<GLuint>::max();
43 stencilFunc_ = GL_ALWAYS;
46 stencilFail_ = stencilPassZFail_ = stencilPassZPass_ = GL_KEEP;
51 enableTest_ = enable ? GL_TRUE : GL_FALSE;
61 stencilFunc_ = comparisonFunc;
66 referenceValue_ = referenceValue;
72 stencilFail_ = stencilFail;
73 stencilPassZFail_ = stencilPassZFail;
74 stencilPassZPass_ = stencilPassZPass;
80 glEnable(GL_STENCIL_TEST);
81 glStencilFunc(stencilFunc_, referenceValue_, stencilMask_);
82 glStencilOp(stencilFail_, stencilPassZFail_, stencilPassZPass_);
84 glDisable(GL_STENCIL_TEST);
87 GLF_THROW_ON_OPENGL_ERROR;
void SetStencilTest(bool enable)
Sets whether to use stencil buffer tests.
Defines the usage of the stencil buffer.
void SetStencilOperation(GLenum stencilFail, GLenum stencilPassZFail, GLenum stencilPassZPass)
Defines the operation of the stencil test.
void SetReferenceValue(GLint referenceValue)
Sets the reference value for the comprison function.
void SetStencilMask(GLuint mask)
Sets the mask of bits that shall be considered for stencil test from the stencil mask and the stencil...
void Bind() const
Binds the stencil buffer mode.
void SetStencilFunc(GLenum comparisonFunc)
Sets the stencil buffer comparison function.
static const glfStencilBufferMode DEFAULT
The default stencil buffer mode.