[osg-users] some questions about Frame Scheme ON_DEMAND
Gianni Ambrosio
g.ambrosio+osg at gmail.com
Fri Jul 17 07:03:17 PDT 2015
Hi All,
I was using the default CONTINUOUS Frame Scheme but I got CPU consumption even if the application was idle.
I'm developing a Qt application (but my question is not strictly related to that).
So, I moved to ON_DEMAND frame scheme.
I use a Qt timer connected to the QWidget::update() slot so that the paint event is triggered.
Here in my viewer widget constructor:
connect(&timer, SIGNAL(timeout()), this, SLOT(update()));
Then the QPaintEvent handled as follows:
void ViewerWidget::paintEvent(QPaintEvent* iEvent)
{
if (osgViewer::ViewerBase::CONTINUOUS == getRunFrameScheme() || true == checkNeedToDoFrame()) {
frame();
}
}
I added a custom NodeTrackerManipulator, derived from the OSG one, to the viewer. Mouse interactions work fine because of us.requestRedraw() calls implemented on the OSG side of the manipulator.
But I have some cases not working.
1) I implemented some methods to fit the whole 3D scene, to set views along X/Y/Z axes, or to switch from perspective to orthographic views. In those cases I don't have a GUIActionAdapter to call a requestRedraw() on to. So is there a way from the manipulator to get the view?
2) If a node (with geometry) is added to the scene (as child of an existing node) the view is not updated. I expected that case was automatically handled. How could I solve this issue?
Regards,
Gianni
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=64344#64344
More information about the osg-users
mailing list