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

2016-04-06 Thread Bruno Oliveira
That's perfect! Thank you very much!

2016-04-06 1:52 GMT+01:00 Jannik Heller :

> Hi,
>
> The camera manipulator (which sets the main camera's view matrix) is
> updated at the end of the update traversal. So, you need to make sure your
> sync code runs after the update traversal and not before - else you'll be
> working with the last frame's data which is probably what's introducing the
> flicker.
>
> Something like this should work. There may be a more elegant solution.
>
> // instead of mViewer->frame(); syncCamera(); :
>
> mViewer->eventTraversal();
> mViewer->updateTraversal();
> syncCamera();
> mViewer->renderingTraversals();
>
> Cheers,
> Jannik
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=66738#66738
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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

2016-04-05 Thread Jannik Heller
Hi,

The camera manipulator (which sets the main camera's view matrix) is updated at 
the end of the update traversal. So, you need to make sure your sync code runs 
after the update traversal and not before - else you'll be working with the 
last frame's data which is probably what's introducing the flicker.

Something like this should work. There may be a more elegant solution.

// instead of mViewer->frame(); syncCamera(); :

mViewer->eventTraversal();
mViewer->updateTraversal();
syncCamera();
mViewer->renderingTraversals();

Cheers,
Jannik

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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

2016-04-05 Thread Bruno Oliveira
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?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org