I have issues with initialization of the osgTrackballManipulator. The
problem appears when using the TaoFramework (coding in C#) so that may
be a factor. Regardless of what initial conditions I specify for the
trackball, the scene starts out witht the eyepoint in the XY-plane
several hundred meters from the origin. Here is the initialization code:

        public void InitializeOSG()
        {
            timerRefresh.Enabled = false;
            _timer = new Osg.Timer();
            _viewer = new Viewer(); 
            _gw = _viewer.setUpViewerAsEmbeddedInWindow(0, 0, Width,
Height);

            // Declare and allocate a trackball manipulator to control
the view
            TrackballManipulator l_TrackballManipulator = new
TrackballManipulator();

            // Use a quaternion to setup the trackball
            l_TrackballManipulator.setCenter(new Osg.Vec3d(0.0, 0.0,
0.0));  
            Osg.Quat initRotation = new Osg.Quat();
            initRotation.makeRotate( DegToRad(45.0), 0.0, 0.0, 1.0 );
// Tried both degrees and radians here... no difference
            l_TrackballManipulator.setRotation( initRotation );
// SEEMS TO DO NOTHING
            l_TrackballManipulator.setDistance(1.0);
// SEEMS TO DO NOTHING
            l_TrackballManipulator.setMinimumZoomScale(0.0);    //
Preclude pushing the TO point near the target

            // Apply the trackball manipulator to the camera manipulator
            _viewer.setCameraManipulator( l_TrackballManipulator);

            // Specify single-threaded viewing
 
_viewer.setThreadingModel(Viewer.ThreadingModel.SingleThreaded);
            _viewer.setSceneData(new Osg.Group());
            _viewer.realize();
            timerRefresh.Enabled = true;
            _viewer.frame(_timer.time_s()); //!< Draw one time to kick
out the old OpenGL buffer

            // DEBUG: Get trackball manipulators back to see how they
are really set...
            Osg.Vec3d center = l_TrackballManipulator.getCenter();
            double distance = l_TrackballManipulator.getDistance();
            double zoomScale =
l_TrackballManipulator.getMinimumZoomScale();
        }

I would welcome any ideas about why this code does not establish the
initial view...

Bob Gallaway

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to