[osg-users] Camera resize vs setViewport

Robert Osfield robert.osfield at gmail.com
Fri Feb 24 03:30:43 PST 2017


Hi Ravi,

The resize is primarily for responding to window resize events where
you need to adjust the viewport and projection matrix to provide
sensible on screen behaviour.

The setViewport() method just sets the viewport, it doesn't try to do
anything with any other paramters such as the projection matrix.

Robert.

On 24 February 2017 at 03:13, Ravi Mathur <ravidavi at utexas.edu> wrote:
> Hi all,
>
> In osg::Camera, there exist two resize functions: Camera::resize(width, height) and Camera::setViewport(x, y, width, height). I'm confused conceptually as to when to use which one. Some examples use resize (osgdistortion), whereas others use setViewport (osghud).
>
> Looking at the Camera.cpp code, it looks like resize() calls setViewport(), but why does it not then accept x/y position arguments? For example, I have a CompositeViewer with multiple Views. Each View has a master & slave (HUD) camera, which are set up in a grid format on the GraphicsContext. I initialize each master/slave combo using setViewport() but I can't use Camera::resize() since I can't pass it the x/y coordinates.
>
> What am I missing here? When is it appropriate to call Camera::resize() instead of Camera::setViewport()?
>
> Thanks,
> Ravi
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=70333#70333
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



More information about the osg-users mailing list