I use the approach outlined in
http://www.3drealtimesimulation.com/osg/osg_faq_1.htm#f40 for embedding OSG
within an existing application, and I'm using OSG 2.6.0 on Windows XP.
I have some custom Drawables that I add to the scenegraph, and I pass them
some frame rendering context data into their drawImplementation method
during the rendering phase like this:
// sets up the application context data
osg::ref_ptr< MyRenderInfoUserData > rpUserData = new
MyRenderInfoUserData({my frame rendering context data});
// makes the context data available to Drawables that do *not* use GL
DisplayLists
mySceneView->getRenderInfo().setUserData( rpUserData.get() );
// makes the context data available to Drawables that *do* use GL
DisplayLists
osg::NodeVisitor *pNodeVisitor = mySceneView->getInitVisitor();
osgUtil::GLObjectsVisitor *pGLObjectsVisitor =
dynamic_cast<osgUtil::GLObjectsVisitor *>(pNodeVisitor);
if (pGLObjectsVisitor)
{
pGLObjectsVisitor->getRenderInfo().setUserData( rpUserData.get() );
}
// make the rendering calls
mySceneView->update ();
mySceneView->cull ();
mySceneView->draw ();
where
class MyRenderInfoUserData : public osg::Referenced { ... }
This seems a bit convoluted, is there a more elegant way to do what I want?
-- Russell
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org