<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Thanks Robert, that's actually what I tried initially and it renders fine, however there's a usability issue. For more background I'm rendering light fields. In order to do this I set up an array of thousands of slightly offset cameras in a rectangular grid pattern. Because I'm capturing so many views when I call <span style="font-family:Arial,Helvetica,sans-serif">osgViewer::Viewer::frame() </span>it locks the main thread and the application becomes unresponsive for a long time. </div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Ideally what I'd like is for the main application to continue rendering its single 3d view, while I render these thousands of cameras to a texture in a background thread. I'm rendering to a texture now without issue, but what's eluded me so far is how I can run this process without locking up the application.</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 have a snapshot of the scene graph for this background thread so that the user can continue to use the main 3d view while the background thread renders a static copy of the scene graph. This is why I've been attempting to clone the root scene node recursively and pass it to my thread. Any concerns with that approach?</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Cheers,</div><div class="gmail_default" style="font-family:tahoma,sans-serif">Rob</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif"><br></span></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif"><br></span></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">Message: 9</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">Date: Thu, 28 Feb 2019 18:53:19 +0000</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">From: Robert Osfield <</span><a href="mailto:robert.osfield@gmail.com" target="_blank" style="font-family:Arial,Helvetica,sans-serif">robert.osfield@gmail.com</a><span style="font-family:Arial,Helvetica,sans-serif">></span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">To: OpenSceneGraph Users <</span><a href="mailto:osg-users@lists.openscenegraph.org" target="_blank" style="font-family:Arial,Helvetica,sans-serif">osg-users@lists.openscenegraph.org</a><span style="font-family:Arial,Helvetica,sans-serif">></span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">Subject: Re: [osg-users] Deep cloning an active root scene node</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">Message-ID:</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif"> <</span><a href="mailto:CAFN7Y%2BWMmVdWhgQJsnkoPvKo9zi3mWm149mrdGMhBUHxJpLtrw@mail.gmail.com" target="_blank" style="font-family:Arial,Helvetica,sans-serif">CAFN7Y+WMmVdWhgQJsnkoPvKo9zi3mWm149mrdGMhBUHxJpLtrw@mail.gmail.com</a><span style="font-family:Arial,Helvetica,sans-serif">></span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">Content-Type: text/plain; charset="UTF-8"</span><br style="font-family:Arial,Helvetica,sans-serif"><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">Hi Rob,</span><br style="font-family:Arial,Helvetica,sans-serif"><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">The OSG is design to allow you to rendering multiple views at once,</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">there is no need to clone the scene graph, you simply add another View</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">to a CompositeView to add the extra rendering. You can toggle</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">optional View's on/off as you need them.</span><br style="font-family:Arial,Helvetica,sans-serif"><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">Robert.</span> <br></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">Message: 7</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">Date: Thu, 28 Feb 2019 14:20:46 -0330</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">From: Robert Lockyer <</span><a href="mailto:robert.lockyer@avalonholographics.com" target="_blank" style="font-family:Arial,Helvetica,sans-serif">robert.lockyer@avalonholographics.com</a><span style="font-family:Arial,Helvetica,sans-serif">></span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">To: </span><a href="mailto:osg-users@lists.openscenegraph.org" target="_blank" style="font-family:Arial,Helvetica,sans-serif">osg-users@lists.openscenegraph.org</a><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">Subject: [osg-users] Deep cloning an active root scene node</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">Message-ID:</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif"> <CAGUte1dn64d=</span><a href="mailto:pcQXMrgQTShbQqDHKmdVcpd%2B09czFjNqb9JfZA@mail.gmail.com" target="_blank" style="font-family:Arial,Helvetica,sans-serif">pcQXMrgQTShbQqDHKmdVcpd+09czFjNqb9JfZA@mail.gmail.com</a><span style="font-family:Arial,Helvetica,sans-serif">></span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">Content-Type: text/plain; charset="utf-8"</span><br style="font-family:Arial,Helvetica,sans-serif"><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">Hi all, my name is Rob.</span><br style="font-family:Arial,Helvetica,sans-serif"><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">I'm currently writing a plugin for an OSG based application. I effectively</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">want to create a snapshot of the application's scene graph state and pass</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">it to another thread where I can render to a texture, while the main</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">rendering thread continues with minimal interruption.</span><br style="font-family:Arial,Helvetica,sans-serif"><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">I'd like to do this because blocking the main thread with a</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">osgViewer::Viewer::frame() call causes the application to lock up and</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">prevents me from displaying a progress dialog. The scene I render takes a</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">long time because I render many camera views to a single texture.</span><br style="font-family:Arial,Helvetica,sans-serif"><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">I'm currently trying to do this:</span><br style="font-family:Arial,Helvetica,sans-serif"><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">osg::Node* sceneCopy =</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">dynamic_cast<osg::Node*>(scene</span><span style="font-family:Arial,Helvetica,sans-serif">Data_->clone(osg::CopyOp::</span><span style="font-family:Arial,Helvetica,sans-serif">DEEP_COPY_ALL));</span><br style="font-family:Arial,Helvetica,sans-serif"><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">Then passing this to another thread where I run:</span><br style="font-family:Arial,Helvetica,sans-serif"><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">viewer_ = new osgViewer::Viewer();</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">viewer_->setSceneData(sceneCop</span><span style="font-family:Arial,Helvetica,sans-serif">y);</span><br style="font-family:Arial,Helvetica,sans-serif"><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">However the behavior seems inconsistent. It either dies on a null reference</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">inside osgEarth somewhere or it renders an empty scene. I don't think I</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">fully understand the threading model of OSG, I've read a bit here and</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">there, but I think there's a lot I'm still missing.</span><br style="font-family:Arial,Helvetica,sans-serif"><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">Is there a safe way to copy the scene data and use it to run an isolated</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">viewer like this in parallel? Is it even safe to run two viewers in</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">parallel like this at all?</span><br style="font-family:Arial,Helvetica,sans-serif"><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">Cheers,</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">Rob</span> <br></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_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">Robert Lockyer<br style="color:rgb(23,43,77)"><span style="color:rgb(23,43,77)">Software Developer<br></span><span style="color:rgb(23,43,77)"><img src="http://www.avalonholographics.com/wp-content/uploads/2018/11/logo.png" width="200" height="44"><br>Office: 1-709-701-</span><span style="color:rgb(23,43,77)">0281</span><br style="color:rgb(23,43,77)"><span style="color:rgb(23,43,77)">Email: </span><a href="mailto:robert.lockyer@avalonholographics.com" rel="nofollow" style="color:rgb(53,114,176)" target="_blank">robert.lockyer@avalonholographics.com</a></font><br></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>