HI Art, As osg::GraphicsContext "has a" osg::State object, while the Viewer/Composite class "has a" collections one or more GraphicsContexts virtue of the Cameras that they maintain. The viewer classes have a convenience method getContexts(ViewerBase:Contexts&) which you can use to get the contexts. i.e.
Viewer::Contexts contexts; viewer.getContexts(contexts); for(Viewer::Contexts::iterator itr = contexts.begin(); itr != contexts.end(); ++itr) { osg::GraphicsContext* context = *itr; osg::State* state = context->getState(); // do with me what you will } On Mon, Mar 10, 2008 at 3:39 PM, Art Tevs <[EMAIL PROTECTED]> wrote: > Hi folks, > > imagine I have a class derived from osgViewer::Viewer. > No I need the correct osg::State to apply something. > Where to get it from? > > > 1. One solution could be: > > dynamic_cast<osgViewer::Renderer*>(getCamera()->getRenderer())->getSceneView(0)->getState(); > > however this state seems not to be initialized and I > have manually to call the initializeExtensionProcs() > method. And this seems not to be elegant solution. > > > 2. Second solution could be: > _currentContext->getState(); > > however _currentContext seems to be NULL during the > run of osgViewer::Viewer. > > > Hence where to get the correct state from? I do not > have any SceneView or similar things defined, just the > customized viewer. > > > Best regards, > Art > > > > > > Machen Sie Yahoo! zu Ihrer Startseite. Los geht's: > http://de.yahoo.com/set > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org