Hi Russel,

That FAQ is obviously a bit out of date.  With the 2.x series of the
OSG the most convinient way to embed the OSG is to use
osgViewer::GraphicsWindowEmbedded.  The osgviewerglut and osgviewersdl
examples demonstrate this usage model.

As for RenderInfo user data, I couldn't really follow what you are
doing or why.  The best I can do is point you at code that I've used
the RenderInfo user data for, and that the osgText::FadeText so go
look at src/osgText/FadeText.cpp.  Note, there isn't any application
level hardwiring here - it's all created on the fly.

Robert.

On Sat, Dec 20, 2008 at 12:19 AM, Russell East <[email protected]> wrote:
> 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
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to