#include <lvt/State.h>
Inheritance diagram for StencilTest:
The StencilTest class controls both stencil testing, the stencil operation and writes to the stencil buffer. Disabling the class (via State::Disable) will disable both stencil testing and stencil writes. To disable stencil testing, but leave stencil writes enabled, set the stencil test function to GL_ALWAYS:
StencilTest *st = new StencilTest;
st->SetStencilFunc(GL_ALWAYS);
The StencilTest class supports two-sided stencil via OpenGL 2.0 core, ATI_separate_stencil, and EXT_stencil_two_side. StencilTest does not support separate stencil buffer masks for front and back polygons as EXT_stencil_two_side does. StencilTest will first try the OpenGL 2.0 core entry points. Failing that, it will try ATI_separate_stencil. ATI_separate_stencil does not support separate reference values and masks in the call to SetStencilFunc, so the reference value and mask for front faces is also used for back faces. If no two-sided stencil extension is present, StencilTest will fall back to one-sided stencil using the parameters set for front faces.
Public Member Functions | |
GLenum | GetStencilFailOp (GLenum face) const |
Returns the current fail stencil operation for the specified face. | |
GLenum | GetStencilFunc (GLenum face) const |
Returns the current stencil function for the specified face. | |
GLuint | GetStencilMask () const |
Returns the current stencil mask. | |
GLenum | GetStencilZFailOp (GLenum face) const |
Returns the current zfail stencil operation for the specified face. | |
GLenum | GetStencilZPassOp (GLenum face) const |
Returns the current zpass stencil operation for the specified face. | |
bool | HasTwoSidedStencil () const |
Returns true if the implementation has some support for two-sided stencil. | |
virtual void | Render () |
Activates the State. | |
void | SetStencilFunc (GLenum face, GLenum func, GLint ref, GLuint mask) |
Sets the current stencil function. | |
void | SetStencilMask (GLuint mask) |
Sets the current stencil mask. | |
void | SetStencilOp (GLenum face, GLenum fail, GLenum zfail, GLenum zpass) |
Sets the current stencil operation. |
|
Returns the current fail stencil operation for the specified face. If two-sided stencil is not supported by the current implementation, the face parameter is ignored. |
|
Returns the current stencil function for the specified face. If two-sided stencil is not supported by the current implementation, the face parameter is ignored. |
|
Returns the current stencil mask.
|
|
Returns the current zfail stencil operation for the specified face. If two-sided stencil is not supported by the current implementation, the face parameter is ignored. |
|
Returns the current zpass stencil operation for the specified face. If two-sided stencil is not supported by the current implementation, the face parameter is ignored. |
|
Returns true if the implementation has some support for two-sided stencil.
|
|
Activates the State. If the State is enabled, the corresponding piece of OpenGL state is enabled and its value is set, if appropriate. If the State object is disabled, the corresponding piece of OpenGL state is disabled. Implements State. |
|
Sets the current stencil function. If two-sided stencil is not supported by the current implementation, the face parameter is ignored. |
|
Sets the current stencil mask. Set the stencil mask to 0 to disable writes to the stencil buffer. The default is all 1s (i.e. ~0). |
|
Sets the current stencil operation.
If two-sided stencil is not supported by the current implementation, the face parameter is ignored. |