Thanks for help!

I am setting the focal lense x and y with the following calls now and it seems 
to work fine:


double fovy = 2 * atan(this->_height / 2.0 / dFocalLengthY);
double aspectRatio = this->_nWidth / this->_nHeight * dFocalLengthY / 
dFocalLengthX;
double zNear = 0.1, zFar = 100.0;

_viewer.getCamera()->setProjectionMatrix(::osg::Matrix::perspective(fovy, 
aspectRatio, zNear, zFar));


But i still can't set up the position and rotation of the viewer's camera. 

this->_viewer.getCamera()->setReferenceFrame(::osg::Transform::ABSOLUTE_RF);
this->_viewer.getCamera()->setViewMatrix(::osg::Matrix::translate(0.5, 0.3, 
0.1));

this does nothing. 

My guess is becase i also have to call:

::osg::ref_ptr< ::osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new 
::osgGA::KeySwitchMatrixManipulator;

keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new 
::osgGA::TrackballManipulator() );

this->_viewer.setCameraManipulator( keyswitchManipulator.get() );

or the offscreen capture doesn't render the scene, just an empty background. It 
looks like viewer needs a camera manipulator or it won't render the scene.


Is it at all possible to move the camera programmatically after a camera 
manipulator has been set for the viewer? Or can i avoid creating a camera 
manipulator?

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=34672#34672





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to