Hi Igor,

> 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?
>

Well, it seems like the cameramanipulator is causing this. To define
manually a view matrix for the camera viewer, you need eigther not to use a
camera manipulator or to set the second parameter of
Viewer::setCameraManipulator (resetPosition)  to false.

Be aware that in case you don't define a camera manipulator, calling
Viewer::run() will automatically add a TrackballManipulator. In this case,
just replace the Vewer::run() call by the rendering loop :

while(!viewer.done())
{
    viewer.frame();
}

Another possible issue is the view matrix itself. If you don't see the
scene, it is generally due to a wrong view Matrix.

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

Reply via email to