Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Class Members

StencilTest Class Reference
[Scene Graph]

#include <lvt/State.h>

Inheritance diagram for StencilTest:

Inheritance graph
[legend]
List of all members.

Detailed Description

Controls stencil testing.

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.


Member Function Documentation

GLenum GetStencilFailOp GLenum  face  )  const
 

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.

GLenum GetStencilFunc GLenum  face  )  const
 

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.

GLuint GetStencilMask  )  const [inline]
 

Returns the current stencil mask.

GLenum GetStencilZFailOp GLenum  face  )  const
 

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.

GLenum GetStencilZPassOp GLenum  face  )  const
 

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.

bool HasTwoSidedStencil  )  const
 

Returns true if the implementation has some support for two-sided stencil.

virtual void Render  )  [virtual]
 

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.

void SetStencilFunc GLenum  face,
GLenum  func,
GLint  ref,
GLuint  mask
 

Sets the current stencil function.

If two-sided stencil is not supported by the current implementation, the face parameter is ignored.

void SetStencilMask GLuint  mask  )  [inline]
 

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).

void SetStencilOp GLenum  face,
GLenum  fail,
GLenum  zfail,
GLenum  zpass
 

Sets the current stencil operation.

Parameters:
face The polygon type to apply the stencil operation to one of GL_FRONT, GL_BACK, or GL_FRONT_AND_BACK
fail Action to take when the stencil test fails.
zfail Action to take when the stencil test passes but the depth test fails.
zpass Action to take when both the stencil test and the depth test pass.
See the man page for glStencilOp or the OpenGL Red Book for more information about the values accepted for fail, zfail, and zpass. The default for all three actions is GL_KEEP.

If two-sided stencil is not supported by the current implementation, the face parameter is ignored.


Generated on Thu Feb 17 09:45:48 2005 for liblvt by  doxygen 1.4.1