# osg::State Class Reference

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

Inheritance diagram for osg::State:

[legend]
List of all members.

## Public Types

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

## Public Member Functions

| State ()
void | pushStateSet (const StateSet *dstate)
| Push stateset onto state stack.
void | popStateSet ()
| Pop stateset off state stack.
void | popAllStateSets ()
| pop all statesets off state stack, ensuring it is empty ready for the next frame.
void | captureCurrentState (StateSet &stateset) const
| Copy the modes and attributes which capture the current state.
void | reset ()
| reset the state object to an empty stack.
const Viewport * | getCurrentViewport () const
void | setInitialViewMatrix (const osg::RefMatrix *matrix)
const osg::Matrix & | getInitialViewMatrix () const
const osg::Matrix & | getInitialInverseViewMatrix () const
void | applyProjectionMatrix (const osg::RefMatrix *matrix)
const osg::Matrix & | getProjectionMatrix () const
void | applyModelViewMatrix (const osg::RefMatrix *matrix)
const osg::Matrix & | getModelViewMatrix () const
Polytope | getViewFrustum () const
void | apply (const StateSet *dstate)
| Apply stateset.
void | apply ()
| Apply the state.
void | setGlobalDefaultModeValue (StateAttribute::GLMode mode, bool enabled)
bool | getGlobalDefaultModeValue (StateAttribute::GLMode mode)
bool | applyMode (StateAttribute::GLMode mode, bool enabled)
| Apply an OpenGL mode if required.
void | setGlobalDefaultTextureModeValue (unsigned int unit, StateAttribute::GLMode mode, bool enabled)
bool | getGlobalDefaultTextureModeValue (unsigned int unit, StateAttribute::GLMode mode)
bool | applyTextureMode (unsigned int unit, StateAttribute::GLMode mode, bool enabled)
void | setGlobalDefaultAttribute (const StateAttribute *attribute)
const StateAttribute * | getGlobalDefaultAttribute (StateAttribute::Type type, unsigned int member=0)
bool | applyAttribute (const StateAttribute *attribute)
| Apply an attribute if required.
void | setGlobalDefaultTextureAttribute (unsigned int unit, const StateAttribute *attribute)
const StateAttribute * | getGlobalDefaultTextureAttribute (unsigned int unit, StateAttribute::Type type, unsigned int member=0)
bool | applyTextureAttribute (unsigned int unit, const StateAttribute *attribute)
void | haveAppliedMode (StateAttribute::GLMode mode, StateAttribute::GLModeValue value)
| Mode has been set externally, update state to reflect this setting.
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(..).
void | haveAppliedAttribute (const StateAttribute *attribute)
| Attribute has been applied externally, update state to reflect this setting.
void | haveAppliedAttribute (StateAttribute::Type type, unsigned int member=0)
| Attribute has been applied externally, and therefore this attribute type has been dirtied and will need to be re-applied on next osg::State.apply(..).
bool | getLastAppliedMode (StateAttribute::GLMode mode) const
| Get whether the current specified mode is enabled (true) or disabled (false).
const StateAttribute * | getLastAppliedAttribute (StateAttribute::Type type, unsigned int member=0) const
| Get the current specified attribute, return NULL if one has not yet been applied.
void | haveAppliedTextureMode (unsigned int unit, StateAttribute::GLMode mode, StateAttribute::GLModeValue value)
| texture Mode has been set externally, update state to reflect this setting.
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(..)
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, StateAttribute::Type type, unsigned int member=0)
| 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(..).
bool | getLastAppliedTextureMode (unsigned int unit, StateAttribute::GLMode mode) const
| Get whether the current specified texture mode is enabled (true) or disabled (false).
const StateAttribute * | getLastAppliedTextureAttribute (unsigned int unit, StateAttribute::Type type, unsigned int member=0) const
| Get the current specified texture attribute, return NULL if one has not yet been applied.
void | dirtyAllModes ()
| Dirty the modes previously applied in osg::State.
void | dirtyAllAttributes ()
| Dirty the modes attributes previously applied in osg::State.
void | disableAllVertexArrays ()
| disable the vertex, normal, color, tex coords, secondary color, fog coord and index arrays.
void | dirtyAllVertexArrays ()
| dirty the vertex, normal, color, tex coords, secondary color, fog coord and index arrays.
void | setInterleavedArrays (GLenum format, GLsizei stride, const GLvoid *pointer)
| Wrapper around glInterleavedArrays(..).
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 around glDisableClientState(GL_VERTEX_ARRAY).
void | dirtyVertexPointer ()
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 | dirtyNormalPointer ()
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 | dirtyColorPointer ()
bool | isSecondaryColorSupported () const
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 | dirtySecondaryColorPointer ()
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 | dirtyIndexPointer ()
bool | isFogCoordSupported () const
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 | dirtyFogCoordPointer ()
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 | dirtyTexCoordPointer (unsigned int unit)
void | disableTexCoordPointersAboveAndIncluding (unsigned int unit)
void | dirtyTexCoordPointersAboveAndIncluding (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 | setVertexAttribPointer (unsigned int index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr)
| wrapper around glEnableVertexAttribArrayARB(index);glVertexAttribPointerARB(..); note, only updates values that change.
void | disableVertexAttribPointer (unsigned int index)
| wrapper around DisableVertexAttribArrayARB(index); note, only updates values that change.
void | disableVertexAttribPointersAboveAndIncluding (unsigned int index)
void | dirtyVertexAttribPointersAboveAndIncluding (unsigned int index)
bool | isVertexBufferObjectSupported () const
void | setContextID (unsigned int contextID)
| Set the current OpenGL context uniqueID.
unsigned int | getContextID () const
| Get the current OpenGL context unique ID.
void | setFrameStamp (FrameStamp *fs)
| Set the frame stamp for the current frame.
const FrameStamp * | getFrameStamp () const
| Get the frame stamp for the current frame.
void | setDisplaySettings (DisplaySettings *vs)
| Set the DisplaySettings.
const DisplaySettings * | getDisplaySettings () const
| Get the DisplaySettings.
void | setAbortRenderingPtr (bool *abortPtr)
| Set flag for early termination of the draw traversal.
bool | getAbortRendering () const
| Get flag for early termination of the draw traversal, if true steps should be taken to complete rendering early.
void | setReportGLErrors (bool flag)
bool | getReportGLErrors () const
bool | checkGLErrors (const char *str) const
bool | checkGLErrors (StateAttribute::GLMode mode) const
bool | checkGLErrors (const StateAttribute *attribute) const

## Protected Types

typedef std::map< StateAttribute::GLMode, ModeStack > | ModeMap
typedef std::vector< ModeMap > | TextureModeMapList
typedef std::map< StateAttribute::TypeMemberPair, AttributeStack > | AttributeMap
typedef std::vector< AttributeMap > | TextureAttributeMapList
typedef std::vector< const StateSet * > | StateSetStack
typedef std::vector< ref_ptr< const Matrix > > | MatrixStack
typedef std::vector< EnabledArrayPair > | EnabledTexCoordArrayList
typedef std::vector< EnabledArrayPair > | EnabledVertexAttribArrayList

## Protected Member Functions

virtual | ~State ()
bool | applyMode (StateAttribute::GLMode mode, bool enabled, ModeStack &ms)
| apply an OpenGL mode if required, passing in mode, enable flag and appropriate mode stack
bool | applyAttribute (const StateAttribute *attribute, AttributeStack &as)
| apply an attribute if required, passing in attribute and appropriate attribute stack
bool | applyGlobalDefaultAttribute (AttributeStack &as)
ModeMap & | getOrCreateTextureModeMap (unsigned int unit)
AttributeMap & | getOrCreateTextureAttributeMap (unsigned int unit)
void | pushModeList (ModeMap &modeMap, const StateSet::ModeList &modeList)
void | pushAttributeList (AttributeMap &attributeMap, const StateSet::AttributeList &attributeList)
void | popModeList (ModeMap &modeMap, const StateSet::ModeList &modeList)
void | popAttributeList (AttributeMap &attributeMap, const StateSet::AttributeList &attributeList)
void | applyModeList (ModeMap &modeMap, const StateSet::ModeList &modeList)
void | applyAttributeList (AttributeMap &attributeMap, const StateSet::AttributeList &attributeList)
void | applyModeMap (ModeMap &modeMap)
void | applyAttributeMap (AttributeMap &attributeMap)
void | haveAppliedMode (ModeMap &modeMap, StateAttribute::GLMode mode, StateAttribute::GLModeValue value)
void | haveAppliedMode (ModeMap &modeMap, StateAttribute::GLMode mode)
| mode has been set externally, update state to reflect this setting.
void | haveAppliedAttribute (AttributeMap &attributeMap, const StateAttribute *attribute)
| attribute has been applied externally, update state to reflect this setting.
void | haveAppliedAttribute (AttributeMap &attributeMap, StateAttribute::Type type, unsigned int member)
bool | getLastAppliedMode (const ModeMap &modeMap, StateAttribute::GLMode mode) const
const StateAttribute * | getLastAppliedAttribute (const AttributeMap &attributeMap, StateAttribute::Type type, unsigned int member) const
bool | computeSecondaryColorSupported () const
bool | computeFogCoordSupported () const
bool | computeVertexBufferObjectSupported () const

## Protected Attributes

unsigned int | _contextID
ref_ptr< FrameStamp > | _frameStamp
ref_ptr< const RefMatrix > | _identity
ref_ptr< const RefMatrix > | _initialViewMatrix
ref_ptr< const RefMatrix > | _projection
ref_ptr< const RefMatrix > | _modelView
Matrix | _initialInverseViewMatrix
ref_ptr< DisplaySettings > | _displaySettings
bool * | _abortRenderingPtr
bool | _reportGLErrors
ModeMap | _modeMap
AttributeMap | _attributeMap
TextureModeMapList | _textureModeMapList
TextureAttributeMapList | _textureAttributeMapList
StateSetStack | _drawStateStack
EnabledArrayPair | _vertexArray
EnabledArrayPair | _normalArray
EnabledArrayPair | _colorArray
EnabledArrayPair | _secondaryColorArray
EnabledArrayPair | _indexArray
EnabledArrayPair | _fogArray
EnabledTexCoordArrayList | _texCoordArrayList
EnabledVertexAttribArrayList | _vertexAttribArrayList
unsigned int | _currentActiveTextureUnit
unsigned int | _currentClientActiveTextureUnit
bool | _isSecondaryColorSupportResolved
bool | _isSecondaryColorSupported
bool | _isFogCoordSupportResolved
bool | _isFogCoordSupported
bool | _isVertexBufferObjectSupportResolved
bool | _isVertexBufferObjectSupported

## Classes

struct | AttributeStack
struct | EnabledArrayPair
struct | ModeStack

## Detailed Description

State class for managing a state stack.

Lazy state updating is used to minimize state changes.

## Member Typedef Documentation

typedef std::map<StateAttribute::TypeMemberPair,AttributeStack> osg::State::AttributeMap `[protected]`

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

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

typedef std::vector<EnabledArrayPair> osg::State::EnabledTexCoordArrayList `[protected]`

typedef std::vector<EnabledArrayPair> osg::State::EnabledVertexAttribArrayList `[protected]`

typedef std::vector<ref_ptr<const Matrix> > osg::State::MatrixStack `[protected]`

typedef std::map<StateAttribute::GLMode,ModeStack> osg::State::ModeMap `[protected]`

typedef std::vector<const StateSet*> osg::State::StateSetStack `[protected]`

typedef std::vector<AttributeMap> osg::State::TextureAttributeMapList `[protected]`

typedef std::vector<ModeMap> osg::State::TextureModeMapList `[protected]`

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

## Constructor & Destructor Documentation

State::State | ( |  | ) |

State::~State | ( |  | ) | `[protected, virtual]`

## Member Function Documentation

void State::apply | ( |  | ) |

| Apply the state.

void State::apply | ( | const StateSet * | dstate | ) |

| Apply stateset.

bool osg::State::applyAttribute | ( | const StateAttribute * | attribute,
|  | AttributeStack & | as
| ) | `[inline, protected]`

| apply an attribute if required, passing in attribute and appropriate attribute stack

bool osg::State::applyAttribute | ( | const StateAttribute * | attribute | ) | `[inline]`

| Apply an attribute if required.

void osg::State::applyAttributeList | ( | AttributeMap & | attributeMap,
|  | const StateSet::AttributeList & | attributeList
| ) | `[inline, protected]`

void osg::State::applyAttributeMap | ( | AttributeMap & | attributeMap | ) | `[inline, protected]`

bool osg::State::applyGlobalDefaultAttribute | ( | AttributeStack & | as | ) | `[inline, protected]`

bool osg::State::applyMode | ( | StateAttribute::GLMode | mode,
|  | bool | enabled,
|  | ModeStack & | ms
| ) | `[inline, protected]`

| apply an OpenGL mode if required, passing in mode, enable flag and appropriate mode stack

bool osg::State::applyMode | ( | StateAttribute::GLMode | mode,
|  | bool | enabled
| ) | `[inline]`

| Apply an OpenGL mode if required.

void osg::State::applyModeList | ( | ModeMap & | modeMap,
|  | const StateSet::ModeList & | modeList
| ) | `[inline, protected]`

void osg::State::applyModelViewMatrix | ( | const osg::RefMatrix * | matrix | ) | `[inline]`

void osg::State::applyModeMap | ( | ModeMap & | modeMap | ) | `[inline, protected]`

void osg::State::applyProjectionMatrix | ( | const osg::RefMatrix * | matrix | ) | `[inline]`

bool osg::State::applyTextureAttribute | ( | unsigned int | unit,
|  | const StateAttribute * | attribute
| ) | `[inline]`

bool osg::State::applyTextureMode | ( | unsigned int | unit,
|  | StateAttribute::GLMode | mode,
|  | bool | enabled
| ) | `[inline]`

void State::captureCurrentState | ( | StateSet & | stateset | ) | const

| Copy the modes and attributes which capture the current state.

bool State::checkGLErrors | ( | const StateAttribute * | attribute | ) | const

bool State::checkGLErrors | ( | StateAttribute::GLMode | mode | ) | const

bool State::checkGLErrors | ( | const char * | str | ) | const

bool State::computeFogCoordSupported | ( |  | ) | const`[protected]`

bool State::computeSecondaryColorSupported | ( |  | ) | const`[protected]`

bool State::computeVertexBufferObjectSupported | ( |  | ) | const`[protected]`

void State::dirtyAllAttributes | ( |  | ) |

| Dirty the modes attributes previously applied in osg::State.

void State::dirtyAllModes | ( |  | ) |

| Dirty the modes previously applied in osg::State.

void State::dirtyAllVertexArrays | ( |  | ) |

| dirty the vertex, normal, color, tex coords, secondary color, fog coord and index arrays.

void osg::State::dirtyColorPointer | ( |  | ) | `[inline]`

void osg::State::dirtyFogCoordPointer | ( |  | ) | `[inline]`

void osg::State::dirtyIndexPointer | ( |  | ) | `[inline]`

void osg::State::dirtyNormalPointer | ( |  | ) | `[inline]`

void osg::State::dirtySecondaryColorPointer | ( |  | ) | `[inline]`

void osg::State::dirtyTexCoordPointer | ( | unsigned int | unit | ) | `[inline]`

void osg::State::dirtyTexCoordPointersAboveAndIncluding | ( | unsigned int | unit | ) | `[inline]`

void osg::State::dirtyVertexAttribPointersAboveAndIncluding | ( | unsigned int | index | ) | `[inline]`

void osg::State::dirtyVertexPointer | ( |  | ) | `[inline]`

void State::disableAllVertexArrays | ( |  | ) |

| disable the vertex, normal, color, tex coords, secondary color, fog coord and index arrays.

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 State::disableVertexAttribPointer | ( | unsigned int | index | ) |

| wrapper around DisableVertexAttribArrayARB(index); note, only updates values that change.

void State::disableVertexAttribPointersAboveAndIncluding | ( | unsigned int | index | ) |

void osg::State::disableVertexPointer | ( |  | ) | `[inline]`

| wrapper around glDisableClientState(GL_VERTEX_ARRAY). note, only updates values that change.

bool osg::State::getAbortRendering | ( |  | ) | const`[inline]`

| Get flag for early termination of the draw traversal, if true steps should be taken to complete rendering early.

unsigned int osg::State::getContextID | ( |  | ) | const`[inline]`

| Get the current OpenGL context unique ID.

const Viewport* osg::State::getCurrentViewport | ( |  | ) | const`[inline]`

const DisplaySettings* osg::State::getDisplaySettings | ( |  | ) | const`[inline]`

| Get the DisplaySettings.

const FrameStamp* osg::State::getFrameStamp | ( |  | ) | const`[inline]`

| Get the frame stamp for the current frame.

const StateAttribute* osg::State::getGlobalDefaultAttribute | ( | StateAttribute::Type | type,
|  | unsigned int | member = `0`
| ) | `[inline]`

bool osg::State::getGlobalDefaultModeValue | ( | StateAttribute::GLMode | mode | ) | `[inline]`

const StateAttribute* osg::State::getGlobalDefaultTextureAttribute | ( | unsigned int | unit,
|  | StateAttribute::Type | type,
|  | unsigned int | member = `0`
| ) | `[inline]`

bool osg::State::getGlobalDefaultTextureModeValue | ( | unsigned int | unit,
|  | StateAttribute::GLMode | mode
| ) | `[inline]`

const osg::Matrix& osg::State::getInitialInverseViewMatrix | ( |  | ) | const`[inline]`

const osg::Matrix& osg::State::getInitialViewMatrix | ( |  | ) | const`[inline]`

const StateAttribute * State::getLastAppliedAttribute | ( | const AttributeMap & | attributeMap,
|  | StateAttribute::Type | type,
|  | unsigned int | member
| ) | const`[protected]`

const StateAttribute * State::getLastAppliedAttribute | ( | StateAttribute::Type | type,
|  | unsigned int | member = `0`
| ) | const

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

bool State::getLastAppliedMode | ( | const ModeMap & | modeMap,
|  | StateAttribute::GLMode | mode
| ) | const`[protected]`

bool State::getLastAppliedMode | ( | StateAttribute::GLMode | mode | ) | const

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

const StateAttribute * State::getLastAppliedTextureAttribute | ( | unsigned int | unit,
|  | StateAttribute::Type | type,
|  | unsigned int | member = `0`
| ) | const

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

bool State::getLastAppliedTextureMode | ( | unsigned int | unit,
|  | 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]`

AttributeMap& osg::State::getOrCreateTextureAttributeMap | ( | unsigned int | unit | ) | `[inline, protected]`

ModeMap& osg::State::getOrCreateTextureModeMap | ( | unsigned int | unit | ) | `[inline, protected]`

const osg::Matrix& osg::State::getProjectionMatrix | ( |  | ) | const`[inline]`

bool osg::State::getReportGLErrors | ( |  | ) | const`[inline]`

Polytope State::getViewFrustum | ( |  | ) | const

void State::haveAppliedAttribute | ( | AttributeMap & | attributeMap,
|  | StateAttribute::Type | type,
|  | unsigned int | member
| ) | `[protected]`

void State::haveAppliedAttribute | ( | AttributeMap & | attributeMap,
|  | const StateAttribute * | attribute
| ) | `[protected]`

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

void State::haveAppliedAttribute | ( | StateAttribute::Type | type,
|  | unsigned int | member = `0`
| ) |

Attribute has been applied externally, and therefore this attribute type has been dirtied and will need to be re-applied 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 cause the osg::State to track the current state more accurately and enable lazy state updating such that only changed state will be applied.

void State::haveAppliedAttribute | ( | const StateAttribute * | attribute | ) |

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

void State::haveAppliedMode | ( | ModeMap & | modeMap,
|  | StateAttribute::GLMode | mode
| ) | `[protected]`

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

void State::haveAppliedMode | ( | ModeMap & | modeMap,
|  | StateAttribute::GLMode | mode,
|  | StateAttribute::GLModeValue | value
| ) | `[protected]`

void State::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(..).

void State::haveAppliedMode | ( | StateAttribute::GLMode | mode,
|  | StateAttribute::GLModeValue | value
| ) |

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

void State::haveAppliedTextureAttribute | ( | unsigned int | unit,
|  | StateAttribute::Type | type,
|  | unsigned int | member = `0`
| ) |

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 accurately and enable lazy state updating such that only changed state will be applied.

void State::haveAppliedTextureAttribute | ( | unsigned int | unit,
|  | const StateAttribute * | attribute
| ) |

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

void State::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(..)

void State::haveAppliedTextureMode | ( | unsigned int | unit,
|  | StateAttribute::GLMode | mode,
|  | StateAttribute::GLModeValue | value
| ) |

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

bool osg::State::isFogCoordSupported | ( |  | ) | const`[inline]`

bool osg::State::isSecondaryColorSupported | ( |  | ) | const`[inline]`

bool osg::State::isVertexBufferObjectSupported | ( |  | ) | const`[inline]`

void State::popAllStateSets | ( |  | ) |

| pop all statesets off state stack, ensuring it is empty ready for the next frame. Note, to return OpenGL to default state, one should do any state.popAllStatSets(); state.apply().

void osg::State::popAttributeList | ( | AttributeMap & | attributeMap,
|  | const StateSet::AttributeList & | attributeList
| ) | `[inline, protected]`

void osg::State::popModeList | ( | ModeMap & | modeMap,
|  | const StateSet::ModeList & | modeList
| ) | `[inline, protected]`

void State::popStateSet | ( |  | ) |

| Pop stateset off state stack.

void osg::State::pushAttributeList | ( | AttributeMap & | attributeMap,
|  | const StateSet::AttributeList & | attributeList
| ) | `[inline, protected]`

void osg::State::pushModeList | ( | ModeMap & | modeMap,
|  | const StateSet::ModeList & | modeList
| ) | `[inline, protected]`

void State::pushStateSet | ( | const StateSet * | dstate | ) |

| Push stateset onto state stack.

void State::reset | ( |  | ) |

| reset the state object to an empty stack.

void osg::State::setAbortRenderingPtr | ( | bool * | abortPtr | ) | `[inline]`

| Set flag for early termination of the draw traversal.

bool 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 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::StateAttribute'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 in 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 set up. By default contextID is 0.

void osg::State::setDisplaySettings | ( | DisplaySettings * | vs | ) | `[inline]`

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

void 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::setGlobalDefaultAttribute | ( | const StateAttribute * | attribute | ) | `[inline]`

void osg::State::setGlobalDefaultModeValue | ( | StateAttribute::GLMode | mode,
|  | bool | enabled
| ) | `[inline]`

void osg::State::setGlobalDefaultTextureAttribute | ( | unsigned int | unit,
|  | const StateAttribute * | attribute
| ) | `[inline]`

void osg::State::setGlobalDefaultTextureModeValue | ( | unsigned int | unit,
|  | StateAttribute::GLMode | mode,
|  | bool | enabled
| ) | `[inline]`

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 State::setInitialViewMatrix | ( | const osg::RefMatrix * | matrix | ) |

void State::setInterleavedArrays | ( | GLenum | format,
|  | GLsizei | stride,
|  | const GLvoid * | pointer
| ) |

| Wrapper around glInterleavedArrays(..). also resets the internal array points and modes within osg::State to keep the other vertex array operations consistent.

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::setReportGLErrors | ( | bool | flag | ) | `[inline]`

void 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 State::setVertexAttribPointer | ( | unsigned int | index,
|  | GLint | size,
|  | GLenum | type,
|  | GLboolean | normalized,
|  | GLsizei | stride,
|  | const GLvoid * | ptr
| ) |

| wrapper around glEnableVertexAttribArrayARB(index);glVertexAttribPointerARB(..); 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.

## Member Data Documentation

bool* osg::State::_abortRenderingPtr `[protected]`

AttributeMap osg::State::_attributeMap `[protected]`

EnabledArrayPair osg::State::_colorArray `[protected]`

unsigned int osg::State::_contextID `[protected]`

unsigned int osg::State::_currentActiveTextureUnit `[protected]`

unsigned int osg::State::_currentClientActiveTextureUnit `[protected]`

ref_ptr<DisplaySettings> osg::State::_displaySettings `[protected]`

StateSetStack osg::State::_drawStateStack `[protected]`

EnabledArrayPair osg::State::_fogArray `[protected]`

ref_ptr<FrameStamp> osg::State::_frameStamp `[protected]`

ref_ptr<const RefMatrix> osg::State::_identity `[protected]`

EnabledArrayPair osg::State::_indexArray `[protected]`

Matrix osg::State::_initialInverseViewMatrix `[protected]`

ref_ptr<const RefMatrix> osg::State::_initialViewMatrix `[protected]`

bool osg::State::_isFogCoordSupported `[mutable, protected]`

bool osg::State::_isFogCoordSupportResolved `[mutable, protected]`

bool osg::State::_isSecondaryColorSupported `[mutable, protected]`

bool osg::State::_isSecondaryColorSupportResolved `[mutable, protected]`

bool osg::State::_isVertexBufferObjectSupported `[mutable, protected]`

bool osg::State::_isVertexBufferObjectSupportResolved `[mutable, protected]`

ref_ptr<const RefMatrix> osg::State::_modelView `[protected]`

ModeMap osg::State::_modeMap `[protected]`

EnabledArrayPair osg::State::_normalArray `[protected]`

ref_ptr<const RefMatrix> osg::State::_projection `[protected]`

bool osg::State::_reportGLErrors `[protected]`

EnabledArrayPair osg::State::_secondaryColorArray `[protected]`

EnabledTexCoordArrayList osg::State::_texCoordArrayList `[protected]`

TextureAttributeMapList osg::State::_textureAttributeMapList `[protected]`

TextureModeMapList osg::State::_textureModeMapList `[protected]`

EnabledArrayPair osg::State::_vertexArray `[protected]`

EnabledVertexAttribArrayList osg::State::_vertexAttribArrayList `[protected]`

The documentation for this class was generated from the following files:

- State
- State.cpp