The OpenGL view matrix is an inverse transform. Try negating the
translation.
   -Paul
 


  _____  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tueller,
Shayne R Civ USAF AFMC 519 SMXS/MXDEC
Sent: Monday, June 23, 2008 3:44 PM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] camera view matrix problems...



I'm attempting to explicitly set the view matrix for a camera in osgViewer.
I'm not using viewer->run() so I'm not using the default camera manipulator.
Here's the code I'm using:

 

osg::Matrixf vm;

vm.setRotate(osg::Quat(0.0, osg::Vec3(0.0, 0.0, 1.0),

                                                   0.0, osg::Vec3(1.0, 0.0,
0.0),

                                                   0.0, osg::Vec3(0.0, 1.0,
0.0)));

vm.setTrans(osg::Vec3f(eyex, eyey, eyez));

viewer->getCamera()->setViewMatrix(vm);

 

I'm expecting to see a view of the terrain that is centered around (eyex,
eyey, eyez) and I see nothing. Can someone tell me what I'm doing wrong in
the code above?

 

Thanks,

-Shayne

 

P.S. When I use the command:

 

viewer->setViewMatrixAsLookAt() 

 

with the same eye point (with lookat and up vectors), I can see the terrain
as expected.

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

Reply via email to