<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Hi all, my name is Rob.</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">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. </div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">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. <br></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">I'm currently trying to do this:</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default"><font face="tahoma, sans-serif">osg::Node* sceneCopy = dynamic_cast<osg::Node*>(sceneData_->clone(osg::CopyOp::DEEP_COPY_ALL));</font><br></div><div class="gmail_default"><font face="tahoma, sans-serif"><br></font></div><div class="gmail_default"><font face="tahoma, sans-serif">Then passing this to another thread where I run:</font></div><div class="gmail_default"><font face="tahoma, sans-serif"><br></font></div><div class="gmail_default"><font face="tahoma, sans-serif"><div class="gmail_default">viewer_ = new osgViewer::Viewer();</div><div class="gmail_default">viewer_->setSceneData(sceneCopy);</div><div class="gmail_default"><br></div><div class="gmail_default">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. </div><div class="gmail_default"><br></div><div class="gmail_default">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?</div><div class="gmail_default"><br></div><div class="gmail_default">Cheers,</div></font></div><div><div dir="ltr" class="m_-2508736385292440165gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font face="arial, helvetica, sans-serif"><span class="gmail_default" style="font-family:tahoma,sans-serif">Rob</span></font><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
<br>
<span lang="EN-CA"><div><i style="background-color:rgb(255,255,255);color:red;font-family:arial,sans-serif;font-size:12.8px;font-weight:bold">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.</i></div></span>