<div dir="ltr">HI Antoine,<div><br></div><div>Callbacks are just one way of managing updates to the scene graph, whether they are the most appropriate tool for each job depends entirely and usage case, within one application you may well use multiple approaches, using the appropriate tool for each task.</div><div><br></div><div>As a general guide I would suggest that one would use a node callback when you want to encapsulate updates to particular subgraphs so that once you add the callback it looks after its subgraph largely by itself. For instance a subgraph that you want to spin constantly you create/load the subgraph put a transform above it and attach a callback. Once setup you then can just pass the whole subgraph into the main scene graph and not have worry about the implementation details any more.</div><div><br></div><div>If your updates related closely with high level operations then you'd typically push these high level updates into the frame loop - similar to what you seem to be doing right now.</div><div><br></div><div>Robert. </div></div><div class="gmail_extra"><br><div class="gmail_quote">On 18 August 2017 at 18:21, Antoine Rennuit <span dir="ltr"><<a href="mailto:antoinerennuit@hotmail.com" target="_blank">antoinerennuit@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I have a custom DataModel describing objects, relations between them. The objects of my custom DataModel are rendered using OSG.<br>
<br>
Depending on user events in my app, the objects of my DataModel are modified and OSG is being notified of all these modifications. These modifications leads to e.g. osg::<wbr>PositionAttitudeTransforms being updated, node masks being modified, osg::Geodes being added or removed of the graph (via addChild() / removeChild()). This leads to a live 3D rendering with animations...<br>
<br>
I do all the updates of my OSG graph in a raw way, without using callbacks. This gives code such as<br>
<br>
<br>
Code:<br>
<br>
m_worldFrame->setPosition(<wbr>EigenToOsgVector3(m_node->m_<wbr>worldFrame->m_pos));<br>
m_worldFrame->setAttitude(<wbr>EigenToOsgQuat(m_node->m_<wbr>worldFrame->m_quat));<br>
<br>
if (m_worldFrame)<br>
m_worldFrame->setNodeMask(<wbr>0xffffffff);<br>
if (m_mesh)<br>
m_mesh->setNodeMask(<wbr>0xffffffff);<br>
<br>
<br>
<br>
<br>
Now I am currently reading the Beginners' Guide and have read callbacks should be used for animation (chapter 8).<br>
<br>
Does that mean I should use callbacks for all modifications of the osg graph?<br>
<br>
This could be implemented in such a way that when my DataModel is updated a flag is updated which is read by the callbacks and depending on the state of the flag the callback performs the osg graph update of not. This is possible but this looks very heavy to implement...<br>
<br>
Am I getting something wrong? Or should I really use update callbacks for all modifications of the OSG graph (objects moving, setting masks...)?<br>
<br>
Thanks a lot,<br>
<br>
Antoine.[/code]<br>
<br>
------------------<br>
Read this topic online here:<br>
<a href="http://forum.openscenegraph.org/viewtopic.php?p=71456#71456" rel="noreferrer" target="_blank">http://forum.openscenegraph.<wbr>org/viewtopic.php?p=71456#<wbr>71456</a><br>
<br>
<br>
<br>
<br>
<br>
______________________________<wbr>_________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.<wbr>openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.<wbr>org/listinfo.cgi/osg-users-<wbr>openscenegraph.org</a><br>
</blockquote></div><br></div>