OpenSceneGraph
3.0.1
|
Encapsulate OpenGL glStencilFunc/Op/Mask functions. More...
Classes | |
class | Extensions |
Extensions class which encapsulates the querying of extensions and associated function pointers, and provide convenience wrappers to check for the extensions or use the associated functions. More... | |
Public Types | |
enum | Function { NEVER = GL_NEVER, LESS = GL_LESS, EQUAL = GL_EQUAL, LEQUAL = GL_LEQUAL, GREATER = GL_GREATER, NOTEQUAL = GL_NOTEQUAL, GEQUAL = GL_GEQUAL, ALWAYS = GL_ALWAYS } |
enum | Operation { KEEP = GL_KEEP, ZERO = GL_ZERO, REPLACE = GL_REPLACE, INCR = GL_INCR, DECR = GL_DECR, INVERT = GL_INVERT, INCR_WRAP = GL_INCR_WRAP, DECR_WRAP = GL_DECR_WRAP } |
Public Member Functions | |
Stencil () | |
Stencil (const Stencil &stencil, const CopyOp ©op=CopyOp::SHALLOW_COPY) | |
Copy constructor using CopyOp to manage deep vs shallow copy. | |
META_StateAttribute (osg, Stencil, STENCIL) | |
virtual int | compare (const StateAttribute &sa) const |
return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. | |
virtual bool | getModeUsage (StateAttribute::ModeUsage &usage) const |
Return the modes associated with this StateAttribute. | |
void | setFunction (Function func, int ref, unsigned int mask) |
void | setFunction (Function func) |
Function | getFunction () const |
void | setFunctionRef (int ref) |
int | getFunctionRef () const |
void | setFunctionMask (unsigned int mask) |
unsigned int | getFunctionMask () const |
void | setOperation (Operation sfail, Operation zfail, Operation zpass) |
set the operations to apply when the various stencil and depth tests fail or pass. | |
void | setStencilFailOperation (Operation sfail) |
set the operation when the stencil test fails. | |
Operation | getStencilFailOperation () const |
get the operation when the stencil test fails. | |
void | setStencilPassAndDepthFailOperation (Operation zfail) |
set the operation when the stencil test passes but the depth test fails. | |
Operation | getStencilPassAndDepthFailOperation () const |
get the operation when the stencil test passes but the depth test fails. | |
void | setStencilPassAndDepthPassOperation (Operation zpass) |
set the operation when both the stencil test and the depth test pass. | |
Operation | getStencilPassAndDepthPassOperation () const |
get the operation when both the stencil test and the depth test pass. | |
void | setWriteMask (unsigned int mask) |
unsigned int | getWriteMask () const |
virtual void | apply (State &state) const |
apply the OpenGL state attributes. | |
Static Public Member Functions | |
static Extensions * | getExtensions (unsigned int contextID, bool createIfNotInitalized) |
Function to call to get the extension of a specified context. | |
static void | setExtensions (unsigned int contextID, Extensions *extensions) |
The setExtensions method allows users to override the extensions across graphics contexts. | |
Protected Member Functions | |
virtual | ~Stencil () |
Protected Attributes | |
Function | _func |
int | _funcRef |
unsigned int | _funcMask |
Operation | _sfail |
Operation | _zfail |
Operation | _zpass |
unsigned int | _writeMask |
Encapsulate OpenGL glStencilFunc/Op/Mask functions.
All functionality except INCR_WRAP and DECR_WRAP is supported by OpenGL 1.1. INCR_WRAP an DECR_WRAP are available since OpenGL 1.4 or when GL_EXT_stencil_wrap extension is present.
If INCR_WRAP or DECR_WRAP values are used while they are detected to be not supported, the INCR or DECR values are sent to OpenGL instead. Note: do not use Stencil::getFunction() to detect whether WRAP operations is used as the object's value is kept intact. Use osg::Stencil::getExtensions() method instead.
OpenGL 2.0 introduced two side stenciling that is available through osg::StencilTwoSided class.
osg::Stencil::Stencil | ( | ) |
osg::Stencil::Stencil | ( | const Stencil & | stencil, |
const CopyOp & | copyop = CopyOp::SHALLOW_COPY |
||
) | [inline] |
Copy constructor using CopyOp to manage deep vs shallow copy.
virtual osg::Stencil::~Stencil | ( | ) | [protected, virtual] |
virtual void osg::Stencil::apply | ( | State & | ) | const [virtual] |
apply the OpenGL state attributes.
The render info for the current OpenGL context is passed in to allow the StateAttribute to obtain details on the the current context and state.
Reimplemented from osg::StateAttribute.
virtual int osg::Stencil::compare | ( | const StateAttribute & | sa | ) | const [inline, virtual] |
return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.
Implements osg::StateAttribute.
References COMPARE_StateAttribute_Types, and COMPARE_StateAttribute_Parameter.
static Extensions* osg::Stencil::getExtensions | ( | unsigned int | contextID, |
bool | createIfNotInitalized | ||
) | [static] |
Function to call to get the extension of a specified context.
If the Extension object for that context has not yet been created and the 'createIfNotInitalized' flag been set to false then returns NULL. If 'createIfNotInitalized' is true then the Extensions object is automatically created. However, in this case the extension object will only be created with the graphics context associated with ContextID.
Function osg::Stencil::getFunction | ( | ) | const [inline] |
unsigned int osg::Stencil::getFunctionMask | ( | ) | const [inline] |
int osg::Stencil::getFunctionRef | ( | ) | const [inline] |
virtual bool osg::Stencil::getModeUsage | ( | StateAttribute::ModeUsage & | ) | const [inline, virtual] |
Return the modes associated with this StateAttribute.
Reimplemented from osg::StateAttribute.
References osg::StateAttribute::ModeUsage::usesMode().
Operation osg::Stencil::getStencilFailOperation | ( | ) | const [inline] |
get the operation when the stencil test fails.
Operation osg::Stencil::getStencilPassAndDepthFailOperation | ( | ) | const [inline] |
get the operation when the stencil test passes but the depth test fails.
Operation osg::Stencil::getStencilPassAndDepthPassOperation | ( | ) | const [inline] |
get the operation when both the stencil test and the depth test pass.
unsigned int osg::Stencil::getWriteMask | ( | ) | const [inline] |
osg::Stencil::META_StateAttribute | ( | osg | , |
Stencil | , | ||
STENCIL | |||
) |
static void osg::Stencil::setExtensions | ( | unsigned int | contextID, |
Extensions * | extensions | ||
) | [static] |
The setExtensions method allows users to override the extensions across graphics contexts.
Typically used when you have different extensions supported across graphics pipes but need to ensure that they all use the same low common denominator extensions.
void osg::Stencil::setFunction | ( | Function | func, |
int | ref, | ||
unsigned int | mask | ||
) | [inline] |
void osg::Stencil::setFunction | ( | Function | func | ) | [inline] |
void osg::Stencil::setFunctionMask | ( | unsigned int | mask | ) | [inline] |
void osg::Stencil::setFunctionRef | ( | int | ref | ) | [inline] |
set the operations to apply when the various stencil and depth tests fail or pass.
First parameter is to control the operation when the stencil test fails. The second parameter is to control the operation when the stencil test passes, but depth test fails. The third parameter controls the operation when both the stencil test and depth pass. Ordering of parameter is the same as if using glStencilOp(,,).
void osg::Stencil::setStencilFailOperation | ( | Operation | sfail | ) | [inline] |
set the operation when the stencil test fails.
void osg::Stencil::setStencilPassAndDepthFailOperation | ( | Operation | zfail | ) | [inline] |
set the operation when the stencil test passes but the depth test fails.
void osg::Stencil::setStencilPassAndDepthPassOperation | ( | Operation | zpass | ) | [inline] |
set the operation when both the stencil test and the depth test pass.
void osg::Stencil::setWriteMask | ( | unsigned int | mask | ) | [inline] |
Function osg::Stencil::_func [protected] |
unsigned int osg::Stencil::_funcMask [protected] |
int osg::Stencil::_funcRef [protected] |
Operation osg::Stencil::_sfail [protected] |
unsigned int osg::Stencil::_writeMask [protected] |
Operation osg::Stencil::_zfail [protected] |
Operation osg::Stencil::_zpass [protected] |
![]() | Generated at Mon Oct 3 2011 12:39:44 for the OpenSceneGraph by doxygen 1.7.5. |