You can just call frame() in the while loop (if I'm right).
See what the viewer.run() do, you'll have a good overview of what to use or
not.

Vincent.

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

>  The viewer.sync() and viewer.update() seems to be deprecated. And it
> seems a bit odd (at least for me) to just throw away the functionallity
> contained in viewer.run().
>
> I have searched the mail archive but I still can't find any information how
> to properly add and remove content to the scenegraph during runtime, whilst
> still using the viewer.run() method.
>
> /Björn
>
>  ------------------------------
> *Från:* [email protected] [mailto:
> [email protected]] *För *Vincent Bourdier
> *Skickat:* den 5 maj 2009 11:32
> *Till:* OpenSceneGraph Users
> *Ämne:* Re: [osg-users] Adding and removing objects to scenegraph
> duringruntime?
>
> 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
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to