[osg-users] Sync main camera with slave camera rotation

Bruno Oliveira bruno.manata.oliveira at gmail.com
Tue Apr 5 12:12:29 PDT 2016


Hello,

I have an osg::Viewer with a regular camera, and now I added a slave camera
to that viewer. The main camera is controlled by a TrackballManipulator.

Now I would like to sync the rotation of both cameras, i.e., when I
manipulate the main camera with the mouse, I want to apply the same
rotation (ROTATION ONLY!) to the slave camera.

This is how I am doing it:

    osg::Matrixd mat = osg::Matrixd::identity();
    osg::Quat rot = m_mainCamera->getViewMatrix().getRotate();

    m_slaveCamera->setViewMatrix(mat.rotate(rot));


But this does not work very well as it introduces some flicker. How should
this be done correctly?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20160405/7e9709a6/attachment-0001.htm>


More information about the osg-users mailing list