HI Steven,
You'll need to set the home position of the manipulator.
I'd also recommend reviewing the osgsimpleviewerQT* examples, they
will be much simpler to use than trying to wire all the events up
yourself via osgGA::GUIEventAdapter and SceneView. SimpleViewer also
support database paging.
Robert.
On 10/23/06, Steven T. Hatton <[EMAIL PROTECTED]> wrote:
I adapted some old code found on the OSG site for a Qt implementation of
osgGA/GUIEventAdapter and osgGA/GUIActionAdapter. I did *not* extend
osgGA::GraphicsWindow. Instead, I adapted the existing window
implementation.
The widget works in so much as it shows the scene, and will run the simple
animated rotation if I toss it with the mouse. I can also drag the scene
around in all 3 dimensions.
Here's the problem I have. When the program starts, the camera is at the
origin. If I drag the scene to the back, I can see it from the perspective I
want. When I do this, the scene rotates about the origin as I desire. I
want to set the camera away from the origin before the scene is displayed.
My event handler is an osgGA::KeySwitchMatrixManipulator with an
osgGA::TrackballManipulator added to it. If I do a setByMatrix to the
location I want the scene to appear, the objects are positioned correctly,
but when I rotate the scene, it rotates about the camera. If I try to
osgUtil::SceneView->setViewMatrix(where_I_want_it), nothing happens.
This is the code for painting the scene:
void OSGWidget::paintGL() {
if(!isValid()) return;
_frameStamp_rptr->setFrameNumber(_frameStamp_rptr->getFrameNumber() + 1);
_frameStamp_rptr->setReferenceTime(_clock.delta_s(_initialTick,
_clock.tick()));
if (_matrixManipulator_rptr.get())
_sceneView_rptr->setViewMatrix(_matrixManipulator_rptr->getInverseMatrix());
_sceneView_rptr->update();
_sceneView_rptr->cull();
_sceneView_rptr->draw();
}
I suspect that what is happening when I try to set the view matrix is that it
gets overwritten by the paint code.
How can I get the scene (or camera) located away from the origin, but still
have the axis of rotation about the origin?
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/