Hi,

     I am using these two methods: setViewMatrixAsLookAt(eye, center, up)
and getViewMatrixAsLookAt(&eye, &center, &up) with the viewer's camera in
this order and WITHOUT manipulating the camera elsewhere in my code. I don't
have much experience with OSG but isn't the last method supposed to return
in the eye, center and up objects the same parameters that I have used to
set the view matrix before? I've made a simple test:

    viewer.getCamera()->setViewMatrixAsLookAt(osg::Vec3f(10., -10., 2.),
osg::Vec3f(0., 0., 0.), osg::Z_AXIS);

    osg::Vec3f eye;
    osg::Vec3f center;
    osg::Vec3f up;
    viewer.getCamera()->getViewMatrixAsLookAt(eye, center, up);

    cout << "eye " << eye.x() << " " << eye.y() << " " << eye.z() << endl;
    cout << "center " << center.x() << " " << center.y() << " " <<
center.z() << endl;
    cout << "up " << up.x() << " " << up.y() << " " << up.z() << endl;

    And what I've got from the cout's was:

    eye: 10 -10 2 (OK)
    center: 9.29986 -9.29986 1.85997
    up: -0.0990148 0.0990148 0.990148

    What am I doing wrong here? Did I misunderstand the purpose of the
method?

               Renan M Z Mendes
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to