Hi Stefan, The original intention for osgViewer::Viewer usage would be that one would have one viewer running at the application at a time, and normally with just one viewer for the lifetime of the application.
CompositeViewer is the class intended for applications with multiple views and multiple scenes, and it sounds like this would be appropriate for your application rather than Viewer. Is there a reason why you have used Viewer rather than CompositeViewer. As for the initialization of the singleton timer in Viewer::realize(), I don't think it would be appropriate to just initialize this on first call to viewer::realize() in the whole application. If an application wanted to create successive viewers then it's likely that the timer should be reset for each time. I can see instances where you might not want this to happen, so perhaps we'd need a means to switching this reset off, perhaps by passing in a feature mask or bool into viewer::realize() to tell it what it should, and then have a default value that retains the current behaviour to ensure backwards compatibility. Robert. On 23 February 2012 17:33, Stefan Klug <[email protected]> wrote: > Hi, > > I'm currently working on a QT based project which displays multiple scenes, > each in its own widget. I therefore create a osgViewer::Viewer instance for > every scene. > As soon as I create the second viewer, the widget doesn't respond to > mouse/keyboard events for exactly the amount of time elapsed between the > creation of the first viewer and the second viewer. > > I tracked the problem down to osgViewer::Viewer.cpp line 538 (current SVN) > where it says: > > // initialize the global timer to be relative to the current time. > osg::Timer::instance()->setStartTick(); > > Here the singleton timer is reset, which should only happen once in the > application lifetime, not per viewer lifetime. > I guarded that call with a global boolean and the problem went away. > > Would be great if someone with better knowledge of the osg internals could > fix that issue properly. > > Regards > Stefan > > _______________________________________________ > 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

