Hi,

I think the most secured way is to do it like that :

while( !viewer.done() )
>    {
>       viewer.sync();
>       viewer.update();
>
>       modify_scene_graph();
>
>       viewer.frame();
>    }
>
>
If I'm good, the callback allow safe graph modifications, but only on node
children... so depending on what you need, that can be a solution too.
The subject have been discussed lots of time on the mailing list, so check
the archive and you will find some good informations.

Regards,
   Vincent.

2009/5/5 Björn Blissing <[email protected]>

> Hi!
> I have my GameObject class that contains the position of each dynamic game
> object in world coordinates. I also have my GameObjectManager class that
> contains a vector of all game objects. This vector is empty when the program
> starts, but populates with objects during runtime (some objects is also
> removed during runtime).
>
> I've searched the mail achieve but I can't find any good example how to add
> or remove objects to the scenegraph during runtime. I guess it has to be
> done in some form of callback. But which one? According to
> http://www.mail-archive.com/[email protected]/msg00725.html it
> is a bad idea to do it in a updateCallback.
>
> Hopefully someone could give me an example or at least point me at the
> right direction. Maybe there is an osg example I should study in depth?
>
> /Björn Blissing
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to