[osg-users] Using callbacks for all graph modifications?

Antoine Rennuit antoinerennuit at hotmail.com
Fri Aug 18 10:21:42 PDT 2017


Hi all,

I have a custom DataModel describing objects, relations between them. The objects of my custom DataModel are rendered using OSG.

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::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...

I do all the updates of my OSG graph in a raw way, without using callbacks. This gives code such as


Code:

m_worldFrame->setPosition(EigenToOsgVector3(m_node->m_worldFrame->m_pos));
m_worldFrame->setAttitude(EigenToOsgQuat(m_node->m_worldFrame->m_quat));

if (m_worldFrame)
    m_worldFrame->setNodeMask(0xffffffff);
if (m_mesh)
    m_mesh->setNodeMask(0xffffffff);




Now I am currently reading the Beginners' Guide and have read callbacks should be used for animation (chapter 8).

Does that mean I should use callbacks for all modifications of the osg graph?

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...

Am I getting something wrong? Or should I really use update callbacks for all modifications of the OSG graph (objects moving, setting masks...)?

Thanks a lot,

Antoine.[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=71456#71456







More information about the osg-users mailing list