[osg-users] Rotating Slave Camera Views
Jim Perkins
jperk15 at gmail.com
Tue Sep 26 12:56:43 PDT 2017
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20170926/7691b3fb/attachment.htm>
More information about the osg-users
mailing list