There are a lot of ways one could update the scene graph, most of which are perfectly safe to do during the update traversal. There are some however that you need to be mindful - such as adding/removing children of a group as this can invalidate iterators held by the calling code. It safe to change your children but not your siblings or parents during traversal. If you have to do modify ones that are not sensible to do during traversal save all these changes up and do them on batch after the update traversal.
On 7/16/07, Benjamin Cabut <[EMAIL PROTECTED]> wrote:
Hello, I am working on a bench application that do this: using DepthPartitionNode, I fly in a starfield. Stars are Point, Point Smooth or Point Sprite dependind magnitude (calculated depending distance) I want to be able to draw 3D Sphere (and in the future more complex object) when I am near enough to a star. I tryed in the update of this StarsCatalog Object to add a Child to my SceneRoot when I'm close to a star, but as soon as I go in the "travers" application crash... I don't understand why... I tough update was done for this, dynamic modification, so I tough it was possible to dynamicaly add an object to the scene. Is it forbiden to change the scene graph in an update function? is there limitations? Is it the best way to do what I want or do you think of another technics? I tought to instance one or two spheres and change the MatrixTransform when needed in the Updates, but I would like to know if you have better idea... The scene has got currently 120000 Stars but should go to 4 000 000... Regards. CABUT Benjamin _______________________________________________ osg-users mailing list osg-users@openscenegraph.net http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
_______________________________________________ osg-users mailing list osg-users@openscenegraph.net http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/