[osg-users] Trackball and view question

Christophe Medard christophe.medard at oktal.fr
Thu Sep 27 01:31:53 PDT 2007


Hi,

A quick answer that is worth what it's worth for I'm little by little 
entering OSG myself...
For what I know the trackballManipulator hasn't the aim of making the view 
always look at the same location.
The setNode() method() after examination only recomputes 'center' "distanc" 
and so on paremeters of the "home position", taking into account the contenu 
of the passed Node's subgraph. The "home position" is only a reference 
position the camera goes back to upon a hom() call in the code or a pression 
on the space bar by the viewer user.

I don't know if in the module osgGa ther is a manipulator xhose aim is to 
always look at the central location of a given object.

Regarding the right parameters to use to position the camera, it's the view 
matrix. The best is to present to your user the content of that matrix 
(maybe presented in a more "sexy" fashion thant just a 4x4 matrix, I don't 
knox, the translation in the matrix, the rotation, etc.) It can be achieved 
from your mainloop via
osgViewer::getCamera()->getViewMatrix(), or 
osgGA::TrackballManipulator::getMatrix(). The manipulator can afterwards be 
re-set in that position by a call to setByMatrix() or setHomePosition() + 
home()...

Hope that helps...

-- 
Christophe Médard
Société OKTAL (http://www.oktal.fr)
2 impasse Boudeville
31100 Toulouse (France)
Tél. : (+33) 5 62 11 50 10
Fax : (+33) 5 62 11 50 29

----- Original Message ----- 
From: "Poirier, Guillaume" <Guillaume.Poirier at nrc-cnrc.gc.ca>
To: "OpenSceneGraph Users" <osg-users at lists.openscenegraph.org>
Sent: Wednesday, September 26, 2007 9:56 PM
Subject: Re: [osg-users] Trackball and view question



Hi Robert et al.

Let me explain what I want to do accomplish an example:

I load a model with no camera manipulator. I know the camera parameters 
(eye, ctr, up)
that yield a desired pose. I set the viewer camera with those parameters and 
obtain the
desired pose.

Now I want to assume that I don't know those parameters. A user loads a 
model with a trackball
manipulator. He / she can manipulate the model until the desired pose is 
obtained and
recuperate the camera parameters (eye, ctr, up), which should be what I used 
in the previous
step...

Is that more clear ? How would I achieve this ?

regards,


Bill






More information about the osg-users mailing list