[osg-users] Slave cameras in a view

Karl Heijdenberg karl.heijdenberg.osg at gmail.com
Wed Oct 10 06:57:07 PDT 2007


Thanks David for your try to help.

The reply didn't answer to the question about how to calculate the
projectionOffset for slave cameras. How to?


On 10/10/07, David Callu <ledocc at gmail.com> wrote:
>
> Hi Karl
>
>
> 2007/10/10, Karl Heijdenberg <karl.heijdenberg.osg at gmail.com>:
> >
> > Hi,
> >
> > I'm trying to add two cameras to one View in compositeViewer.
> > The first camera is added as a master camera and the second as a slave
> > camera.
>
>
> other correct me if I am wrong, frustum is map on interval [0,
> XWindowSize] and [0, YWindowSize]
>

That is the interval values of the viewport for the camera in the view.

Frustums for the cameras:
> > master={-50, 0, -40, 40}
> > slave={0, 50, -40, 40}
>
>
I use near=1 and far=1000000

For the first camera I set the projectionMatrix with
> > setProjectionMatrixAsFrustum.
>
>
I give these required arguments to the setProjectionMatrixAsFrustum method
(for the master cam):

{left,right,bottom,top,near,far} = {tan(degToRad(-50)) * near, tan(degToRad(0))
* near, tan(degToRad(-40)) * near, tan(degToRad(40)) * near, near, far}


> How do I calculate the projectionOffset for the slave camera?
>
>
This is the question I'm interested in a good answer to!

during update of camera position, the projection matrix for slaveis compute
> as this
> slaveCamera->setProjectionMatrix( masterCamera->getProjectionMatrix() *
> slaveCamera->getProjectionOffset() );
> idem for the view matrix and the viewOffset.
>
>
> The offset is needed in call to addSlave(osg::Camera* camera,const
> > osg::Matrix& projectionOffset, const osg::Matrix& viewOffset, bool
> > useMastersSceneData=true);
> >
> > I've also tried to set the reference frame to
> > ABSOLUTE_RF_INHERIT_VIEWPOINT and then call the setProjectionMatrixAsFrustum
> > for both cameras. This test ended up in a black scene for the second camera.
> > Am I missing something?
> >
> > Thanks, Karl
> > _______________________________________________
> > osg-users mailing list
> > osg-users at lists.openscenegraph.org
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> >
> >
>
> HTH
> David
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




Regards Karl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20071010/b30a9a52/attachment-0003.htm>


More information about the osg-users mailing list