After some additional research, I have learned that the behavior is
different when the threading model is set to SingleThreaded. After
setting the threading model to SingleThreaded, issues #1 and 2# are
effectively gone (I still have to call requestRedraw() for #1). I can
only speculate that there is a race condition somewhere that I have not
tracked down.
Regards,
Judson
On 3/13/2013 2:06 PM, Judson Weissert wrote:
Hello,
I have been working on switching over to ON_DEMAND frame updates while
using osgViewer::Viewer and I encountered the following problems (all
of these issues are specific to ON_DEMAND frame updates):
1. Some of the event handlers such as osgViewer::HelpHandler, and
osgViewer::ScreenCaptureHandler (maybe others) do not request a new
frame explicitly after their keyboard events are triggered. However, a
number of the event handlers in the same folder do (such as the
StatsHandler). Thus, the HelpHandler does nothing until something else
triggers a frame update. If I add another event handler before the
HelpHandler and call osgGA::GUIActionAdapter::requestRedraw() when "h"
is pressed, then the behavior is similar to that of the StatsHandler,
and the first key press does not seem to have any effect (see
StatsHandler behavior below), but all subsequent key presses work as
expected.
2. The StatsHandler does not show up after pressing "s" the first
time. Every subsequent time "s" is pressed, the StatsHandler behaves
as expected.
3. The default behavior of Viewer::checkNeedToDoFrame() makes it
difficult to use with scene graphs that contain UpdateCallbacks
because there is no easy way that I have found to disable or modify
the getNumChildrenRequiringUpdateTraversal() check (without deriving).
Some example code:
osg::ref_ptr <osgViewer::Viewer> viewer (new osgViewer::Viewer ());
// Setup viewer camera and context here...
// ...
viewer->addEventHandler (new osgViewer::StatsHandler ());
viewer->setRunFrameScheme (osgViewer::ViewerBase::ON_DEMAND);
viewer->run ();
I did override the osgViewer::Viewer::checkNeedToDoFrame() behavior to
skip the UpdateCallback check (so frames were not continuously
rendered as a result) in order to address issue #3 above.
Thank you,
Judson
_______________________________________________
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