class SG_EXPORT osg::State

State class for managing a state stack.

Inheritance:


Public Methods

[more] State()
[more]virtual ~State()
[more]void pushStateSet(const StateSet* dstate)
push stateset onto state stack
[more]void popStateSet()
pop drawstate off state stack
[more]void captureCurrentState(StateSet& stateset) const
copy the modes and attributes which captures the current state
[more]void reset()
reset the state object to an empty stack
[more]inline void applyProjectionMatrix(const osg::Matrix* matrix)
[more]const osg::Matrix& getProjectionMatrix() const
[more]inline void applyModelViewMatrix(const osg::Matrix* matrix)
[more]const osg::Matrix& getModelViewMatrix() const
[more]Polytope getViewFrustum() const
[more]void apply(const StateSet* dstate)
Apply stateset
[more]void apply()
Apply the state
[more]inline bool applyMode(StateAttribute::GLMode mode, bool enabled)
Apply an OpenGL mode if required.
[more]inline bool applyTextureMode(unsigned int unit, StateAttribute::GLMode mode, bool enabled)
[more]inline bool applyAttribute(const StateAttribute* attribute)
Apply an attribute if required.
[more]inline bool applyTextureAttribute(unsigned int unit, const StateAttribute* attribute)
[more]void haveAppliedMode(StateAttribute::GLMode mode, StateAttribute::GLModeValue value)
Mode has been set externally, update state to reflect this setting
[more]void haveAppliedMode(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()
[more]void haveAppliedAttribute(const StateAttribute* attribute)
Attribute has been applied externally, update state to reflect this setting
[more]void haveAppliedAttribute(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::Stateapply().
[more]bool getLastAppliedMode(StateAttribute::GLMode mode) const
Get whether the current specified mode is enabled (true) or disabled (false)
[more]const StateAttribute* getLastAppliedAttribute(StateAttribute::Type type) const
Get the current specified attribute, return NULL is one has not yet been applied
[more]void haveAppliedTextureMode(unsigned int unit, StateAttribute::GLMode mode, StateAttribute::GLModeValue value)
texture Mode has been set externally, update state to reflect this setting
[more]void haveAppliedTextureMode(unsigned int unit, 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()
[more]void haveAppliedTextureAttribute(unsigned int unit, const StateAttribute* attribute)
texture Attribute has been applied externally, update state to reflect this setting
[more]void haveAppliedTextureAttribute(unsigned int unit, 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::Stateapply().
[more]bool getLastAppliedTextureMode(unsigned int unit, StateAttribute::GLMode mode) const
Get whether the current specified texture mode is enabled (true) or disabled (false)
[more]const StateAttribute* getLastAppliedTextureAttribute(unsigned int unit, StateAttribute::Type type) const
Get the current specified texture attribute, return NULL is one has not yet been applied
[more]void disableAllVertexArrays()
disable the vertex, normal, color, tex coords, secenday color, fog coord and index arrays
[more]void dirtyAllVertexArrays()
dirty the vertex, normal, color, tex coords, secenday color, fog coord and index arrays
[more]inline void setVertexPointer( GLint size, GLenum type, GLsizei stride, const GLvoid* ptr )
wrapper around glEnableClientState(GL_VERTEX_ARRAY);glVertexPointer(); note, only updates values that change
[more]inline void disableVertexPointer()
wrapper glDisableClientState(GL_VERTEX_ARRAY).
[more]inline void dirtyVertexPointer()
[more]inline void setNormalPointer( GLenum type, GLsizei stride, const GLvoid* ptr )
wrapper around glEnableClientState(GL_NORMAL_ARRAY);glNormalPointer(); note, only updates values that change
[more]inline void disableNormalPointer()
wrapper around glDisableClientState(GL_NORMAL_ARRAY); note, only updates values that change
[more]inline void dirtyNormalPointer()
[more]inline void setColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid* ptr )
wrapper around glEnableClientState(GL_COLOR_ARRAY);glColorPointer(); note, only updates values that change
[more]inline void disableColorPointer()
wrapper around glDisableClientState(GL_COLOR_ARRAY); note, only updates values that change
[more]inline void dirtyColorPointer()
[more]inline bool isSecondaryColorSupported() const
[more]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
[more]inline void disableSecondaryColorPointer()
wrapper around glDisableClientState(GL_SECONDARY_COLOR_ARRAY); note, only updates values that change
[more]inline void dirtySecondaryColorPointer()
[more]inline void setIndexPointer( GLenum type, GLsizei stride, const GLvoid* ptr )
wrapper around glEnableClientState(GL_INDEX_ARRAY);glIndexPointer(); note, only updates values that change
[more]inline void disableIndexPointer()
wrapper around glDisableClientState(GL_INDEX_ARRAY); note, only updates values that change
[more]inline void dirtyIndexPointer()
[more]inline bool isFogCoordSupported() const
[more]void setFogCoordPointer( GLenum type, GLsizei stride, const GLvoid* ptr )
wrapper around glEnableClientState(GL_FOG_COORDINATE_ARRAY);glFogCoordPointer(); note, only updates values that change
[more]inline void disableFogCoordPointer()
wrapper around glDisableClientState(GL_FOG_COORDINATE_ARRAY); note, only updates values that change
[more]inline void dirtyFogCoordPointer()
[more]inline 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
[more]inline void disableTexCoordPointer( unsigned int unit )
wrapper around glDisableClientState(GL_TEXTURE_COORD_ARRAY); note, only updates values that change
[more]inline void dirtyTexCoordPointer( unsigned int unit )
[more]inline void disableTexCoordPointersAboveAndIncluding( unsigned int unit )
[more]inline void dirtyTexCoordPointersAboveAndIncluding( unsigned int unit )
[more]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.
[more]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.
[more]inline void setContextID(unsigned int contextID)
Set the current OpenGL context uniqueID.
[more]inline unsigned int getContextID() const
Get the current OpenGL context unique ID
[more]inline void setFrameStamp(FrameStamp* fs)
Set the frame stamp for the current frame
[more]inline const FrameStamp* getFrameStamp() const
Set the frame stamp for the current frame
[more]inline void setDisplaySettings(DisplaySettings* vs)
Set the DisplaySettings.
[more]inline const DisplaySettings* getDisplaySettings() const
Get the DisplaySettings
[more]inline void pushModeList(ModeMap& modeMap, const StateSet::ModeList& modeList)
[more]inline void pushAttributeList(AttributeMap& attributeMap, const StateSet::AttributeList& attributeList)
[more]inline void popModeList(ModeMap& modeMap, const StateSet::ModeList& modeList)
[more]inline void popAttributeList(AttributeMap& attributeMap, const StateSet::AttributeList& attributeList)
[more]inline void applyModeList(ModeMap& modeMap, const StateSet::ModeList& modeList)
[more]inline void applyAttributeList(AttributeMap& attributeMap, const StateSet::AttributeList& attributeList)
[more]inline void applyModeMap(ModeMap& modeMap)
[more]inline void applyAttributeMap(AttributeMap& attributeMap)

Public Members

[more]typedef std::pair<const StateAttribute*,StateAttribute::OverrideValue> AttributePair
[more]typedef std::vector<AttributePair> AttributeVec
[more]typedef std::vector<StateAttribute::GLModeValue> ValueVec


Inherited from Referenced:

Public Methods

oinline Referenced& operator = (Referenced&)
oinline void ref() const
oinline void unref() const
oinline void unref_nodelete() const
oinline int referenceCount() const
oinline static int createdCount()
oinline static int deletedCount()

Protected Fields

omutable int _refCount
ostatic int _createdCount
ostatic int _deletedCount


Documentation

State class for managing a state stack. Lazy state updating is used to minimize state changes.
o State()

ovirtual ~State()

ovoid pushStateSet(const StateSet* dstate)
push stateset onto state stack

ovoid popStateSet()
pop drawstate off state stack

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

ovoid reset()
reset the state object to an empty stack

oinline void applyProjectionMatrix(const osg::Matrix* matrix)

oconst osg::Matrix& getProjectionMatrix() const

oinline void applyModelViewMatrix(const osg::Matrix* matrix)

oconst osg::Matrix& getModelViewMatrix() const

oPolytope getViewFrustum() const

ovoid apply(const StateSet* dstate)
Apply stateset

ovoid apply()
Apply the state

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

oinline bool applyTextureMode(unsigned int unit, StateAttribute::GLMode mode, bool enabled)

oinline bool applyAttribute(const StateAttribute* attribute)
Apply an attribute if required.

oinline bool applyTextureAttribute(unsigned int unit, const StateAttribute* attribute)

ovoid haveAppliedMode(StateAttribute::GLMode mode, StateAttribute::GLModeValue value)
Mode has been set externally, update state to reflect this setting

ovoid haveAppliedMode(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()

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

ovoid haveAppliedAttribute(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::Stateapply(). 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.

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

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

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

ovoid haveAppliedTextureMode(unsigned int unit, 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()

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

ovoid haveAppliedTextureAttribute(unsigned int unit, 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::Stateapply(). 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.

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

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

ovoid disableAllVertexArrays()
disable the vertex, normal, color, tex coords, secenday color, fog coord and index arrays

ovoid dirtyAllVertexArrays()
dirty the vertex, normal, color, tex coords, secenday color, fog coord and index arrays

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

oinline void disableVertexPointer()
wrapper glDisableClientState(GL_VERTEX_ARRAY). note, only updates values that change.

oinline void dirtyVertexPointer()

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

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

oinline void dirtyNormalPointer()

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

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

oinline void dirtyColorPointer()

oinline bool isSecondaryColorSupported() const

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

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

oinline void dirtySecondaryColorPointer()

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

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

oinline void dirtyIndexPointer()

oinline bool isFogCoordSupported() const

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

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

oinline void dirtyFogCoordPointer()

oinline 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

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

oinline void dirtyTexCoordPointer( unsigned int unit )

oinline void disableTexCoordPointersAboveAndIncluding( unsigned int unit )

oinline void dirtyTexCoordPointersAboveAndIncluding( unsigned int unit )

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

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

oinline void setContextID(unsigned int contextID)
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, the contextID simply acts as an index local arrays that they maintain for the purpose. Typical settings for contextID are 0,1,2,3... up to the maximum number of graphics contexts you have setup. By default contextID is 0.

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

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

oinline const FrameStamp* getFrameStamp() const
Set the frame stamp for the current frame

oinline void setDisplaySettings(DisplaySettings* vs)
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.

oinline const DisplaySettings* getDisplaySettings() const
Get the DisplaySettings

otypedef std::pair<const StateAttribute*,StateAttribute::OverrideValue> AttributePair

otypedef std::vector<AttributePair> AttributeVec

otypedef std::vector<StateAttribute::GLModeValue> ValueVec

o ModeStack()

obool changed

obool last_applied_value

obool global_default_value

oValueVec valueVec

o AttributeStack()

obool changed
apply an attribute if required, passing in attribute and appropriate attribute stack

oconst StateAttribute* last_applied_attribute

oref_ptr<StateAttribute> global_default_attribute

oAttributeVec attributeVec

o EnabledArrayPair()

o EnabledArrayPair(const EnabledArrayPair& eap)

oEnabledArrayPair& operator = (const EnabledArrayPair& eap)

obool _dirty

obool _enabled

oconst GLvoid* _pointer

oinline void pushModeList(ModeMap& modeMap, const StateSet::ModeList& modeList)

oinline void pushAttributeList(AttributeMap& attributeMap, const StateSet::AttributeList& attributeList)

oinline void popModeList(ModeMap& modeMap, const StateSet::ModeList& modeList)

oinline void popAttributeList(AttributeMap& attributeMap, const StateSet::AttributeList& attributeList)

oinline void applyModeList(ModeMap& modeMap, const StateSet::ModeList& modeList)

oinline void applyAttributeList(AttributeMap& attributeMap, const StateSet::AttributeList& attributeList)

oinline void applyModeMap(ModeMap& modeMap)

oinline void applyAttributeMap(AttributeMap& attributeMap)


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.