Hi all,
Sorry if my problem is obvious..
I'm currently trying to integrate a trackball manipulator in my
application but I encounter problem especially with the rotation
(problem of point of view ?)
I'm using osgViewer::SimpleViewer since I'm working with QT.
I overloaded the SimpleViewer class since I'm must set manually my
projection matrix. The only method I overloded is the
frameUpdateTraversal() method, in order to be able to use a manually set
projection matrix (and not a perspective or orthographic one).
I integrate the trackball manipulator through my simple viewer.
But when I try to pan my loaded model, it works but the Y and Z axis are
inverted (problem that I already saw since the up direction is different
since you're working with manipulator or not, isn't it ?). The main
problem is the rotation, when I try to rotate my model it is rotated
around the camera? but not around the center of it as expected...
I try to use the trackball manipulator without setting my projection
matrix (leaving the defaults settings of the manipulator) and it works
properly.
How could I set my trackball manipulator in order that it works properly
with my projection matrix too ?
Here the code that I use :
_viewer = *new* MySimpleViewer;
QObject::*connect*(*this*, *SIGNAL*(updateSignal()), *this*,
*SLOT*(updateGL()));
*connect*(&_timer, *SIGNAL*(timeout()), *this*, *SLOT*(updateGL()));
_timer.start(10);
..........
_viewer->setSceneData(_root);
_viewer->setCameraManipulator(*new* osgGA::TrackballManipulator);
...........
static int firstFrame=0;
*if* (!firstFrame){
_viewer->init();
_viewer->getCameraManipulator()->setByMatrix(extrinsicMat); // extrinsicMat is
the modelview matrix
firstFrame++;}
_viewer->frameAdvance();
_viewer->frameEventTraversal();
_viewer->getSceneView()->setProjectionMatrix(intrinsicMat); // intrinsicMat is
the projection matrix -- my projection matrix is (intrinsicMat * extrinsicMat)
_viewer->frameUpdateTraversal();
_viewer->frameCullTraversal();
_viewer->frameDrawTraversal();
.......
Is there any operation to make with the modelview matrix (extrinsicMat)
before setting it in the manipulator ?
Any response or clue are wellcome.
Thank you.
Fred.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/