Hi Björn, 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().
viewer.sync() existed in Producer/osgProducer from the OSG 1.x days, it no longer exists in OSG-2.x's osgViewer. The thread sync itself is done for you inside the Viewer::renderingTraversals(); Also viewer.update() no longer exists, but an equivalent viewer.updateTraversals() does. W.r.t viewer.run(), it's nothing special, it's just a small convenience method meant to make writing small examples very easy. Implementing the frame loop as it's constituent parts is a standard practice. > > 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. Well you can use an update callback, or an update operation... With an update callback you must be very careful about not invalidating iterators so unless you really understand what is going op it's best to avoid it. Writing out the viewer frame loop rather than using viewer.run() is typically the most straight forward way to do things like adding and removing elements from the scene though. The other alternative is to simply switch subraphs on/off using osg::Switch or a NodeMask. Robert. _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

