Hi Himar,

The assumption that I made with osg::Camera is that each camera would
have it's own Viewport, sharing a Viewport between Camera's is not
something I've considered so code like the GraphicsContext code for
passing up updates to resizing of the window will probably be resizing
the viewport onces for each Camera.

Solutions would be to clone the viewport for your slave camera, or
modify the resize code so it doesn't resize viewports that it's
already resized.  The later is really the best solution as it would
remove the assumption of one Viewport per Camera.  I'm currently got
my head down on OpenGL ES work so if you could dive into the
appropriate code and provide a solution it'd appreciated :-)

Cheers,
Robert.

On Mon, Oct 26, 2009 at 1:45 PM, Himar Carmona <[email protected]> wrote:
> 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
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to