Hi Michael,

The way the OSG applications normally manage updates to the scene
graph is to either use a NodeCallback attached as UpdateCallback on
nodes or for the application to run the updates manually during the
frame loop - just by adding calls in between the viewer.advance() and
the viewer.renderingTraversals() (see the implementation of
Viewer::frame() to see how this is done or tutorials on the
composition of the frameloop).

For own application the idea of TimerListerner doesn't fit directly
into the normal OSG usage but you could easily add your own custom
management of updates in a custom frame loop, is simply use an update
callback.  The OSG's update and event traversals only traverse
subgraphs that have update and event callbacks respectively so they
don't traversal subgraph they don't need to so are generally pretty
efficient ways of managing updates.

Robert.

On 21 June 2012 13:34, michael kapelko <[email protected]> wrote:
> Hi.
> I'm going to use OSG as one of my game engine components. Currently I
> have Timer singleton. Classes that wish to be notified regularly
> should inherit from TimerListener and add themselves to the queue like
> Timer->addListener(this, 30); where 30 is 30 milliseconds, i.e., they
> will be notified approximately each 30 milliseconds. In listeners I do
> 'animations' (moving, scaling, etc).
> In OSG, however, each node gets traversed, even several times.
> Currently I'm unsure how to implement my new Timer with OSG. The
> single deciding Timer class seems to require less power, since it
> doesn't call each listener each frame, instead, it knows when to call
> each listener and only does it when necessary.
> May be I'm misunderstanding current visitor pattern? May be it's
> really necessary to traverse each listener each frame and let each
> listener decide?
> _______________________________________________
> 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