[osg-users] [forum] How to set field of view of second slave camera?
Sebastian Messerschmidt
sebastian.messerschmidt at gmx.de
Thu Oct 5 01:19:35 PDT 2017
Hi Milos,
> Hi,
>
> I have problem to set field of view od second slave camera. I used it like lens, but when I on lens camera, distance of my "grapf" is incorect. My lens camera is smaler as you can see in the pic.
>
>
>
> Lens option:
> osg::ref_ptr<osg::Camera> lensCamera = new osg::Camera;
> lensCamera->setCullMask(0x2);
> lensCamera->setGraphicsContext(viewerWidget >getGraphicsWindow());
> lensCamera->setViewport(new osg::Viewport((viewerWidget->width()/4),(viewerWidget->height()/4),viewerWidget->width()/2,viewerWidget->height()/2));
> lensCamera->setReferenceFrame(osg::Transform::RELATIVE_RF);
> viewerWidget->addSlave(lensCamera.get(), osg::Matrix(), osg::Matrix(), true);
>
> I tried something like this : viewerWidget->addSlave(lensCamera.get(), osg::Matrix::scale(2,2,2),osg::Matrixd()); but scale doesnt work. Anyone help me?
The second parameter of the addSlave is the translation offset. You need
to change your slave's frustum by scaling the projection:
viewerWidget->addSlave(lensCamera.get(),osg::Matrixd(),osg::Matrix::scale(2,2,1.0))
Cheers
Sebastian
>
>
> Thank you!
>
> Cheers,
> Milos
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=72101#72101
>
>
>
>
> Attachments:
> http://forum.openscenegraph.org//files/goal_129.png
> http://forum.openscenegraph.org//files/withlens_141.png
> http://forum.openscenegraph.org//files/nolens_743.png
>
>
> _______________________________________________
> 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