[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



if (m_worldFrame)
if (m_mesh)

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,


Read this topic online here:

More information about the osg-users mailing list