[osg-users] Rotating Slave Camera Views
Voerman, L.
l.voerman at rug.nl
Wed Sep 27 00:18:17 PDT 2017
Hi Jim,
you are using "projectionOffset" while I think you want a viewOffset.
Attached is a small example (a mix of osgViewer and the osgSidebySide
example creating 3 views with 52 degrees rotation offset.
Regards, Laurens.
On Tue, Sep 26, 2017 at 9:56 PM, Jim Perkins <jperk15 at gmail.com> wrote:
> Hi everyone,
>
> I am fairly new to OSG and am trying to use slave cameras to view a scene
> from slightly different angles, of which will overlap slightly. I am
> starting with the OSG 3.0 Cookbook example from chapter 4, #2 (source code
> at https://github.com/xarray/osgRecipes).
> Instead of the full 9 cameras, I am working with just two cameras that I
> am aligning side by side, with no rotation as my first test, using the
> following approximate code. In this example, I am attempting to show half
> of a 3D model on each slave camera.
>
> Slave1:
> osg::Matrix projOffset = osg::Matrix::translate(1,0,0);
> viewer.addSlave(camera, projOffset, osg::Matrix(), true);
>
>
> Slave2:
> osg::Matrix projOffset = osg::Matrix::translate(-1,0,0);
>
> viewer.addSlave(camera, projOffset, osg::Matrix(), true);
>
>
> This seems to work fine, with half the 3D model on the left screen, half
> on the right.
>
> When i add in a rotation term, for example, on slave 2:
>
> osg::Matrix projOffset = osg::Matrix::rotate(osg::DegreesToRadians(15),
> osg::Vec3D(0,1,0)) * osg::Matrix::translate(-.8,0,0);
> viewer.addSlave(camera, projOffset, osg::Matrix(), true);
>
> all I see is a tiny sliver of the model. I have tried rotating on
> different axis (placing the 1 in a different spot in the vector), different
> translations, etc. The Z axis seems to work fine, but the X and Y axis are
> not working properly. I am thinking it may be due to an improperly setup
> frustrum, but am having trouble setting it.
>
> I would appreciate any kind of information as to what I may be doing wrong
> or should be looking at.
>
> Thank you!
>
> Jim
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20170927/b8684ecd/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: osgsidebyside3.zip
Type: application/zip
Size: 4242 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20170927/b8684ecd/attachment.zip>
More information about the osg-users
mailing list