Hi Rob, The OSG is design to allow you to rendering multiple views at once, there is no need to clone the scene graph, you simply add another View to a CompositeView to add the extra rendering. You can toggle optional View's on/off as you need them.
Robert. On Thu, 28 Feb 2019 at 17:51, Robert Lockyer <robert.lock...@avalonholographics.com> wrote: > > Hi all, my name is Rob. > > I'm currently writing a plugin for an OSG based application. I effectively > want to create a snapshot of the application's scene graph state and pass it > to another thread where I can render to a texture, while the main rendering > thread continues with minimal interruption. > > I'd like to do this because blocking the main thread with a > osgViewer::Viewer::frame() call causes the application to lock up and > prevents me from displaying a progress dialog. The scene I render takes a > long time because I render many camera views to a single texture. > > I'm currently trying to do this: > > osg::Node* sceneCopy = > dynamic_cast<osg::Node*>(sceneData_->clone(osg::CopyOp::DEEP_COPY_ALL)); > > Then passing this to another thread where I run: > > viewer_ = new osgViewer::Viewer(); > viewer_->setSceneData(sceneCopy); > > However the behavior seems inconsistent. It either dies on a null reference > inside osgEarth somewhere or it renders an empty scene. I don't think I fully > understand the threading model of OSG, I've read a bit here and there, but I > think there's a lot I'm still missing. > > Is there a safe way to copy the scene data and use it to run an isolated > viewer like this in parallel? Is it even safe to run two viewers in parallel > like this at all? > > Cheers, > Rob > > This email and any attachments are confidential and may be privileged. Any > unauthorized use, disclosure, copying or distribution of the information > received is prohibited. If you are not the intended recipient please contact > the sender immediately by return email confirming that you have and will > delete all communications related to the email and any attachments sent to > you in error. > _______________________________________________ > 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