[osg-users] update slave camera with frame scheme ON_DEMAND

Gianni Ambrosio g.ambrosio+osg at gmail.com
Wed Aug 5 02:41:56 PDT 2015


Hi All,
it seems I found the problem but not a solution jet.

In my CrossAxes object (that is an osg::Camera) I do:

setUpdateCallback(new AxesCameraUpdateCallback);

and in AxesCameraUpdateCallback::operator() implementation I have:

   transform->setAttitude(view->getCamera()->getViewMatrix().getRotate());

where "transform" is child of the CrossAxes camera node and parent of the real axes graphics (please see previous message for details).
In AxesCameraUpdateCallback I get the rotation from the camera of the view to show the global axes correctly oriented wrt the current camera orientation.
Unfortunately, in this case, it seems that the first time frame() is called I get an "old" value from

view->getCamera()->getViewMatrix().getRotate()

It seems that the camera view matrix is updated after my AxesCameraUpdateCalback is called. That's wht a second call to frame() fixes axes orientation. 

Since to set the desired point of view I call

NodeTrackerManipulator::setTransformation(const osg::Vec3d& iEye, const osg::Vec3d& iCenter, const osg::Vec3d& iUp)

Which is the proper modification to do on my code to have a correct behaviour? Is there a way to get the correct view matrix in AxesCameraUpdateCallback::operator() implementation?

Best regards,
Gianni

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=64623#64623








More information about the osg-users mailing list