[osg-users] update slave camera with frame scheme ON_DEMAND
Robert Osfield
robert.osfield at gmail.com
Wed Aug 5 03:39:22 PDT 2015
Hi Gianni,
The ordering of update of the view's master Camera is done after the update
traversal, so checking the Camera's value in update traversal will result
in using the previous frames value. The master Camera's value can depend
upon values in the scene graph so this ordering make sense for most
application, and since you are using the NodeTrackerManipulator it's
essential.
So for your application I'd suggest shift the slave Camera (CrossAxes) so
that is' done after the call to viewer::updateTraversal(). This could be
done by simply calling the frame components manually in your application
and then inserting the appropriate update code.
i..e.
while(!viewer.done())
{
viewer.advance();
viewer.eventTraversal();
viewer.updateTraversal();
// do your CrossAxes updating here.
viewer.renderingTraversals();
}
On 5 August 2015 at 10:41, Gianni Ambrosio <g.ambrosio+osg at gmail.com> wrote:
> 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
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150805/ba3b2ccb/attachment-0003.htm>
More information about the osg-users
mailing list