Hi,

   i noticed a strange (buggy?) behavior with two cameras sharing the
same Viewport instance with version 2.9.5 (Windows XP).

   Situation: Main camera, adding a slave camera (with addSlave) and
setting the slave camera's viewport with this line of code:

          slaveCamera->setViewport( viewer.getCamera()->getViewport());

   The objective is to have two cameras rendering to the whole window

   Problem: If the viewer is in window mode (setUpViewInWindow) and
the window is resized, the viewport updates incorrectly. In my case,
it doesn't fill the window.

   I suspect this behaviour is due to
GraphicsContext::resizedImplementation having updated the viewport
twice, since it is share between the two cameras.

   Workaround: Don't share the viewport between two cameras :)

           slaveCamera->setViewport(new
osg::Viewport(*(viewer.getCamera()->getViewport())));

       or

           osg::Viewport* vp = viewer.getCamera()->getViewport();
           slaveCamera->setViewport(vp->x(), vp->y(), vp->width(),
vp->height());

    If this use isn't as expected (i use it wrong) or if
resizedImplementation need to be fixed, then i could try do the job
and submit a patch for this odd behaviour. At least i could modify
Camera and add some comments regarding this behavior. But first i
wanted to know experts advise about it.


   Best regards,
Himar.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to