[osg-users] Stereo View and makeLookAt()

Andreas Goebel a-goebel at gmx.de
Thu Oct 6 08:16:30 PDT 2016


Hi,

to set up my view matrix I use a very simple approach with makeLookAt().

Like this:

        centerPos = osg::Vec3(0,0,0);
        osg::Vec3 viewPos(
        cos(viewElev) * sin(viewRot),
        cos(viewElev) * cos(viewRot),
        sin(viewElev));
        osg::Vec3 up;
        if ( (viewElev > -1.0*osg::PI_2) && (viewElev < osg::PI_2) )
            up = osg::Z_AXIS;
        else
            up = osg::Z_AXIS*-1.0;
        osg::Matrixd look;
        viewPos *= 10.0;
        look.makeLookAt(viewPos, centerPos, up);
        sceneView->setViewMatrix(look);


Recently I´ve discovered that in stereo mode all my objects are behind
the screen, whereas when I use an osgviewer, for example, it´s possible
to pull objects before the screen.

I think that usually objects before (0,0,0) appear before the screen.

Is it generally impossible to set up the view matrix with makeLookAt in
connection with stereo (I use the osg builtin stereo features)?

If so, what route should I take? I manipulate view rotation and view
elevation with the mouse.



Thanks,

Andreas




More information about the osg-users mailing list