State - state sets, attributes, modes and per context state
-
osg::StateSet - a container for a set of modes and attributes with support for multitexturing
-
osg::StateSet::setMode(GL_LIGHTING,osg::StateAttribute::ON) - you can use OpenGL enums modes directly
-
osg::StateSet::setAttribute(attribute) - for adding general state attributes
-
osg::StateSet::setTextureMode(textureunit,GL_TEXTURE_2D,osg::StateAttribute::ON) - for setting texture modes
-
osg::StateSet::setTextureAttribute(textureunit,texattribute) - for add texure attribute
-
Texture unit go from 0 upwards, no upper limit other than imposed by graphics cards/drivers.
-
osg::StateAttributes - encapsulates OpenGL state atribute values
-
24 subclasses from osg::StateSet, covers most OpenGL state, including many extensions
-
For non texturing related state add to a StateSet with setAttribute(..)
-
For texture related state add to a StateSet with setTextureAttribute(..) since you need the texture unit.
osg::StateAttribute::isTextureAttribute() will return true for texture related state.
-
You'll get a warning on the console if you use the wrong set(Texture)Attribute() assignement.
-
osg::State - manages graphics state per graphics context
-
Not part of the scene graph (wheras StateSet/Attribute are part of the scene)
-
Used by the Draw traversal to manage the current graphics state.
-
Supports fine grained (per mode and per attribute) lazy state updating to minimize OpenGL state changes.
-
One per graphics context, use osg::State::setContextID(contextID) to set which context
contextID can be 0,1,2.... for multiple graphics pipes/context
contextID is not a GLX graphics context, just a simple offset into internal multibuffer arrays