|
Public Types |
| enum | CheckForGLErrors { NEVER_CHECK_GL_ERRORS,
ONCE_PER_FRAME,
ONCE_PER_ATTRIBUTE
} |
Public Member Functions |
| | State () |
| void | setGraphicsContext (GraphicsContext *context) |
| | Set the graphics context associated with that owns this State object.
|
| GraphicsContext * | getGraphicsContext () |
| | Get the graphics context associated with that owns this State object.
|
| const GraphicsContext * | getGraphicsContext () const |
| | Get the const graphics context associated with that owns this State object.
|
| void | setContextID (unsigned int contextID) |
| | Set the current OpenGL context uniqueID.
|
| unsigned int | getContextID () const |
| | Get the current OpenGL context unique ID.
|
| 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 () |
| | Updates the OpenGL state so that it matches the StateSet at the top of the stack of StateSets maintained internally by a 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 | setActiveTextureUnit (unsigned int unit) |
| | Set the current texture unit, return true if selected, false if selection failed such as when multitexturing is not supported.
|
| unsigned int | getActiveTextureUnit () const |
| | Get the current texture 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.
|
| unsigned int | getClientActiveTextureUnit () const |
| | Get the current tex coord array texture unit.
|
| 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 | setLastAppliedProgramObject (const Program::PerContextProgram *program) |
| const Program::PerContextProgram * | getLastAppliedProgramObject () const |
| GLint | getUniformLocation (const std::string &name) const |
| GLint | getAttribLocation (const std::string &name) const |
| 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 | setCheckForGLErrors (CheckForGLErrors check) |
| | Set whether and how often OpenGL errors should be checked for.
|
| CheckForGLErrors | getCheckForGLErrors () const |
| | Get whether and how often OpenGL errors should be checked for.
|
| 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::map< std::string,
UniformStack > | UniformMap |
typedef std::vector< const
StateSet * > | StateSetStack |
typedef std::vector< ref_ptr<
const Matrix > > | MatrixStack |
typedef std::set< osg::ref_ptr<
const Program::PerContextProgram > > | AppliedProgramObjectSet |
| 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 | pushUniformList (UniformMap &uniformMap, const StateSet::UniformList &uniformList) |
| void | popModeList (ModeMap &modeMap, const StateSet::ModeList &modeList) |
| void | popAttributeList (AttributeMap &attributeMap, const StateSet::AttributeList &attributeList) |
| void | popUniformList (UniformMap &uniformMap, const StateSet::UniformList &uniformList) |
| void | applyModeList (ModeMap &modeMap, const StateSet::ModeList &modeList) |
| void | applyAttributeList (AttributeMap &attributeMap, const StateSet::AttributeList &attributeList) |
| void | applyUniformList (UniformMap &uniformMap, const StateSet::UniformList &uniformList) |
| void | applyModeMap (ModeMap &modeMap) |
| void | applyAttributeMap (AttributeMap &attributeMap) |
| void | applyUniformMap (UniformMap &uniformMap) |
| void | haveAppliedMode (ModeMap &modeMap, StateAttribute::GLMode mode, StateAttribute::GLModeValue value) |
| void | haveAppliedMode (ModeMap &modeMap, StateAttribute::GLMode mode) |
| void | haveAppliedAttribute (AttributeMap &attributeMap, const StateAttribute *attribute) |
| 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 |
| GraphicsContext * | _graphicsContext |
| 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 |
| CheckForGLErrors | _checkGLErrors |
| ModeMap | _modeMap |
| AttributeMap | _attributeMap |
| UniformMap | _uniformMap |
| TextureModeMapList | _textureModeMapList |
| TextureAttributeMapList | _textureAttributeMapList |
| AppliedProgramObjectSet | _appliedProgramObjectSet |
| const Program::PerContextProgram * | _lastAppliedProgramObject |
| StateSetStack | _stateStateStack |
| 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 |
implements lazy state updating and provides accessors for querrying the current state. . The venerable Red Book says that "OpenGL is a state machine", and this class represents the OpenGL state in OSG. Furthermore, State also has other important features: