Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

osg::State Class Reference

State class for managing a state stack. More...

Inheritance diagram for osg::State:

Inheritance graph
[legend]
List of all members.

Public Types

typedef std::pair< const StateAttribute *,
StateAttribute::OverrideValue
AttributePair
typedef std::vector< AttributePairAttributeVec
typedef std::vector< StateAttribute::GLModeValueValueVec

Public Methods

 State ()
virtual ~State ()
void pushStateSet (const StateSet *dstate)
 push stateset onto state stack.

void popStateSet ()
 pop drawstate off state stack.

void captureCurrentState (StateSet &stateset) const
 copy the modes and attributes which captures the current state.

void reset ()
 reset the state object to an empty stack.

void applyProjectionMatrix (const osg::Matrix *matrix)
const osg::MatrixgetProjectionMatrix () const
void applyModelViewMatrix (const osg::Matrix *matrix)
const osg::MatrixgetModelViewMatrix () const
Polytope getViewFrustum () const
void apply (const StateSet *dstate)
 Apply stateset.

void apply ()
 Apply the state.

const bool applyMode (const StateAttribute::GLMode mode, const bool enabled)
 Apply an OpenGL mode if required.

const bool applyTextureMode (unsigned int unit, const StateAttribute::GLMode mode, const bool enabled)
const bool applyAttribute (const StateAttribute *attribute)
 Apply an attribute if required.

const bool applyTextureAttribute (unsigned int unit, const StateAttribute *attribute)
void haveAppliedMode (const StateAttribute::GLMode mode, const StateAttribute::GLModeValue value)
 Mode has been set externally, update state to reflect this setting.

void haveAppliedMode (const StateAttribute::GLMode mode)
 Mode has been set externally, therefore dirty the associated mode in osg::State so it is applied on next call to osg::State::apply(..).

void haveAppliedAttribute (const StateAttribute *attribute)
 Attribute has been applied externally, update state to reflect this setting.

void haveAppliedAttribute (const StateAttribute::Type type)
 Attribute has been applied externally, and therefore this attribute type has been dirtied and will need to be re-appplied on next osg::State.apply(..).

const bool getLastAppliedMode (const StateAttribute::GLMode mode) const
 Get whether the current specified mode is enabled (true) or disabled (false).

const StateAttributegetLastAppliedAttribute (const StateAttribute::Type type) const
 Get the current specified attribute, return NULL is one has not yet been applied.

void haveAppliedTextureMode (unsigned int unit, const StateAttribute::GLMode mode, const StateAttribute::GLModeValue value)
 texture Mode has been set externally, update state to reflect this setting.

void haveAppliedTextureMode (unsigned int unit, const StateAttribute::GLMode mode)
 texture Mode has been set externally, therefore dirty the associated mode in osg::State so it is applied on next call to osg::State::apply(..)

void haveAppliedTextureAttribute (unsigned int unit, const StateAttribute *attribute)
 texture Attribute has been applied externally, update state to reflect this setting.

void haveAppliedTextureAttribute (unsigned int unit, const StateAttribute::Type type)
 texture Attribute has been applied externally, and therefore this attribute type has been dirtied and will need to be re-appplied on next osg::State.apply(..).

const bool getLastAppliedTextureMode (unsigned int unit, const StateAttribute::GLMode mode) const
 Get whether the current specified texture mode is enabled (true) or disabled (false).

const StateAttributegetLastAppliedTextureAttribute (unsigned int unit, const StateAttribute::Type type) const
 Get the current specified texture attribute, return NULL is one has not yet been applied.

void setVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
 wrapper around glEnableClientState(GL_VERTEX_ARRAY);glVertexPointer(..); note, only updates values that change.

void disableVertexPointer ()
 wrapper glDisableClientState(GL_VERTEX_ARRAY).

void setNormalPointer (GLenum type, GLsizei stride, const GLvoid *ptr)
 wrapper around glEnableClientState(GL_NORMAL_ARRAY);glNormalPointer(..); note, only updates values that change.

void disableNormalPointer ()
 wrapper around glDisableClientState(GL_NORMAL_ARRAY); note, only updates values that change.

void setColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
 wrapper around glEnableClientState(GL_COLOR_ARRAY);glColorPointer(..); note, only updates values that change.

void disableColorPointer ()
 wrapper around glDisableClientState(GL_COLOR_ARRAY); note, only updates values that change.

void setSecondaryColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
 wrapper around glEnableClientState(GL_SECONDARY_COLOR_ARRAY);glSecondayColorPointer(..); note, only updates values that change.

void disableSecondaryColorPointer ()
 wrapper around glDisableClientState(GL_SECONDARY_COLOR_ARRAY); note, only updates values that change.

void setIndexPointer (GLenum type, GLsizei stride, const GLvoid *ptr)
 wrapper around glEnableClientState(GL_INDEX_ARRAY);glIndexPointer(..); note, only updates values that change.

void disableIndexPointer ()
 wrapper around glDisableClientState(GL_INDEX_ARRAY); note, only updates values that change.

void setFogCoordPointer (GLenum type, GLsizei stride, const GLvoid *ptr)
 wrapper around glEnableClientState(GL_FOG_COORDINATE_ARRAY);glFogCoordPointer(..); note, only updates values that change.

void disableFogCoordPointer ()
 wrapper around glDisableClientState(GL_FOG_COORDINATE_ARRAY); note, only updates values that change.

void setTexCoordPointer (unsigned int unit, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
 wrapper around glEnableClientState(GL_TEXTURE_COORD_ARRAY);glTexCoordPointer(..); note, only updates values that change.

void disableTexCoordPointer (unsigned int unit)
 wrapper around glDisableClientState(GL_TEXTURE_COORD_ARRAY); note, only updates values that change.

void disableTexCoordPointersAboveAndIncluding (unsigned int unit)
bool setClientActiveTextureUnit (unsigned int unit)
 set the current tex coord array texture unit, return true if selected, false if selection failed such as when multitexturing is not supported.

bool setActiveTextureUnit (unsigned int unit)
 set the current texture unit, return true if selected, false if selection failed such as when multitexturing is not supported.

void setContextID (unsigned int contextID)
 Set the current OpenGL context uniqueID.

const unsigned int getContextID () const
 Get the current OpenGL context unique ID.

void setFrameStamp (FrameStamp *fs)
 Set the frame stamp for the current frame.

const FrameStampgetFrameStamp () const
 Set the frame stamp for the current frame.

void setDisplaySettings (DisplaySettings *vs)
 Set the DisplaySettings.

const DisplaySettingsgetDisplaySettings () const
 Get the DisplaySettings.


Detailed Description

State class for managing a state stack.

Lazy state updating is used to minimize state changes.


Member Typedef Documentation

typedef std::pair<const StateAttribute*,StateAttribute::OverrideValue> osg::State::AttributePair
 

typedef std::vector<AttributePair> osg::State::AttributeVec
 

typedef std::vector<StateAttribute::GLModeValue> osg::State::ValueVec
 


Constructor & Destructor Documentation

osg::State::State  
 

virtual osg::State::~State   [virtual]
 


Member Function Documentation

void osg::State::apply  
 

Apply the state.

void osg::State::apply const StateSet   dstate
 

Apply stateset.

const bool osg::State::applyAttribute const StateAttribute   attribute [inline]
 

Apply an attribute if required.

const bool osg::State::applyMode const StateAttribute::GLMode    mode,
const bool    enabled
[inline]
 

Apply an OpenGL mode if required.

void osg::State::applyModelViewMatrix const osg::Matrix   matrix [inline]
 

void osg::State::applyProjectionMatrix const osg::Matrix   matrix [inline]
 

const bool osg::State::applyTextureAttribute unsigned int    unit,
const StateAttribute   attribute
[inline]
 

const bool osg::State::applyTextureMode unsigned int    unit,
const StateAttribute::GLMode    mode,
const bool    enabled
[inline]
 

void osg::State::captureCurrentState StateSet   stateset const
 

copy the modes and attributes which captures the current state.

void osg::State::disableColorPointer   [inline]
 

wrapper around glDisableClientState(GL_COLOR_ARRAY); note, only updates values that change.

void osg::State::disableFogCoordPointer   [inline]
 

wrapper around glDisableClientState(GL_FOG_COORDINATE_ARRAY); note, only updates values that change.

void osg::State::disableIndexPointer   [inline]
 

wrapper around glDisableClientState(GL_INDEX_ARRAY); note, only updates values that change.

void osg::State::disableNormalPointer   [inline]
 

wrapper around glDisableClientState(GL_NORMAL_ARRAY); note, only updates values that change.

void osg::State::disableSecondaryColorPointer   [inline]
 

wrapper around glDisableClientState(GL_SECONDARY_COLOR_ARRAY); note, only updates values that change.

void osg::State::disableTexCoordPointer unsigned int    unit [inline]
 

wrapper around glDisableClientState(GL_TEXTURE_COORD_ARRAY); note, only updates values that change.

void osg::State::disableTexCoordPointersAboveAndIncluding unsigned int    unit [inline]
 

void osg::State::disableVertexPointer   [inline]
 

wrapper glDisableClientState(GL_VERTEX_ARRAY).

note, only updates values that change.

const unsigned int osg::State::getContextID   const [inline]
 

Get the current OpenGL context unique ID.

const DisplaySettings* osg::State::getDisplaySettings   const [inline]
 

Get the DisplaySettings.

const FrameStamp* osg::State::getFrameStamp   const [inline]
 

Set the frame stamp for the current frame.

const StateAttribute* osg::State::getLastAppliedAttribute const StateAttribute::Type    type const
 

Get the current specified attribute, return NULL is one has not yet been applied.

const bool osg::State::getLastAppliedMode const StateAttribute::GLMode    mode const
 

Get whether the current specified mode is enabled (true) or disabled (false).

const StateAttribute* osg::State::getLastAppliedTextureAttribute unsigned int    unit,
const StateAttribute::Type    type
const
 

Get the current specified texture attribute, return NULL is one has not yet been applied.

const bool osg::State::getLastAppliedTextureMode unsigned int    unit,
const StateAttribute::GLMode    mode
const
 

Get whether the current specified texture mode is enabled (true) or disabled (false).

const osg::Matrix& osg::State::getModelViewMatrix   const [inline]
 

const osg::Matrix& osg::State::getProjectionMatrix   const [inline]
 

Polytope osg::State::getViewFrustum   const
 

void osg::State::haveAppliedAttribute const StateAttribute::Type    type
 

Attribute has been applied externally, and therefore this attribute type has been dirtied and will need to be re-appplied on next osg::State.apply(..).

note, if you have an osg::StateAttribute which you have applied externally then use the have_applied(attribute) method as this will the osg::State to track the current state more accuratly and enable lazy state updating such that only changed state will be applied.

void osg::State::haveAppliedAttribute const StateAttribute   attribute
 

Attribute has been applied externally, update state to reflect this setting.

void osg::State::haveAppliedMode const StateAttribute::GLMode    mode
 

Mode has been set externally, therefore dirty the associated mode in osg::State so it is applied on next call to osg::State::apply(..).

void osg::State::haveAppliedMode const StateAttribute::GLMode    mode,
const StateAttribute::GLModeValue    value
 

Mode has been set externally, update state to reflect this setting.

void osg::State::haveAppliedTextureAttribute unsigned int    unit,
const StateAttribute::Type    type
 

texture Attribute has been applied externally, and therefore this attribute type has been dirtied and will need to be re-appplied on next osg::State.apply(..).

note, if you have an osg::StateAttribute which you have applied externally then use the have_applied(attribute) method as this will the osg::State to track the current state more accuratly and enable lazy state updating such that only changed state will be applied.

void osg::State::haveAppliedTextureAttribute unsigned int    unit,
const StateAttribute   attribute
 

texture Attribute has been applied externally, update state to reflect this setting.

void osg::State::haveAppliedTextureMode unsigned int    unit,
const StateAttribute::GLMode    mode
 

texture Mode has been set externally, therefore dirty the associated mode in osg::State so it is applied on next call to osg::State::apply(..)

void osg::State::haveAppliedTextureMode unsigned int    unit,
const StateAttribute::GLMode    mode,
const StateAttribute::GLModeValue    value
 

texture Mode has been set externally, update state to reflect this setting.

void osg::State::popStateSet  
 

pop drawstate off state stack.

void osg::State::pushStateSet const StateSet   dstate
 

push stateset onto state stack.

void osg::State::reset  
 

reset the state object to an empty stack.

bool osg::State::setActiveTextureUnit unsigned int    unit
 

set the current texture unit, return true if selected, false if selection failed such as when multitexturing is not supported.

note, only updates values that change.

bool osg::State::setClientActiveTextureUnit unsigned int    unit
 

set the current tex coord array texture unit, return true if selected, false if selection failed such as when multitexturing is not supported.

note, only updates values that change.

void osg::State::setColorPointer GLint    size,
GLenum    type,
GLsizei    stride,
const GLvoid *    ptr
[inline]
 

wrapper around glEnableClientState(GL_COLOR_ARRAY);glColorPointer(..); note, only updates values that change.

void osg::State::setContextID unsigned int    contextID [inline]
 

Set the current OpenGL context uniqueID.

Note, it is the application developers responsibility to set up unique ID for each OpenGL context. This value is then used by osg::StateAttribure's and osg::Drawable's to help manage OpenGL display list and texture binds appropriate for each context.

void osg::State::setDisplaySettings DisplaySettings   vs [inline]
 

Set the DisplaySettings.

Note, nothing is applied, the visual settings are just used used in the State object to pass the current visual settings to Drawables during rendering.

void osg::State::setFogCoordPointer GLenum    type,
GLsizei    stride,
const GLvoid *    ptr
 

wrapper around glEnableClientState(GL_FOG_COORDINATE_ARRAY);glFogCoordPointer(..); note, only updates values that change.

void osg::State::setFrameStamp FrameStamp   fs [inline]
 

Set the frame stamp for the current frame.

void osg::State::setIndexPointer GLenum    type,
GLsizei    stride,
const GLvoid *    ptr
[inline]
 

wrapper around glEnableClientState(GL_INDEX_ARRAY);glIndexPointer(..); note, only updates values that change.

void osg::State::setNormalPointer GLenum    type,
GLsizei    stride,
const GLvoid *    ptr
[inline]
 

wrapper around glEnableClientState(GL_NORMAL_ARRAY);glNormalPointer(..); note, only updates values that change.

void osg::State::setSecondaryColorPointer GLint    size,
GLenum    type,
GLsizei    stride,
const GLvoid *    ptr
 

wrapper around glEnableClientState(GL_SECONDARY_COLOR_ARRAY);glSecondayColorPointer(..); note, only updates values that change.

void osg::State::setTexCoordPointer unsigned int    unit,
GLint    size,
GLenum    type,
GLsizei    stride,
const GLvoid *    ptr
[inline]
 

wrapper around glEnableClientState(GL_TEXTURE_COORD_ARRAY);glTexCoordPointer(..); note, only updates values that change.

void osg::State::setVertexPointer GLint    size,
GLenum    type,
GLsizei    stride,
const GLvoid *    ptr
[inline]
 

wrapper around glEnableClientState(GL_VERTEX_ARRAY);glVertexPointer(..); note, only updates values that change.


The documentation for this class was generated from the following file:
Generated at Wed Sep 18 13:55:42 2002 for the Open Scene Graph by doxygen 1.2.16.