Hi Robert, Thanks for your helpful reply. I've sorted this problem by taking the following steps
1. Removal of camera manipulators from the scene (I had a custom manipulator that allowed you to set target/position, but event handling was done elsewhere in my external application) 2. Creation of a class CCameraView which does little more than hold variables to setup the camera, such as position, target, field of view, near/far, isOrthogonal, orthogonal zoom factor etc.... 3. Multiple instances of my CCameraView class are held by the application, one for the perspective freelook view, one for a plan view, plus others for various views around the scene that I need. These are updated appropriately by my applications event processing code. 4. Setting of the current active CCameraView on the scene as appropriate (depending on what mode the app is in) 5. Within the render loop, immediately prior to Viewer->Frame, call Viewer->getCamera() to get the main camera, and pass it to the current CameraView instance (a method called UpdateCameraMatrices). This then applies the desired view/projection matrix 6. Render the scene Simple really when you know how. I realise the above is not an OSG problem, more a "How to use OSG in my system in such a way" problem, but I am posting as others may find the solution useful. Thank you, Andrew On Wed, Aug 5, 2009 at 10:00 AM, Robert Osfield <[email protected]>wrote: > Hi Andrew, > > On Wed, Aug 5, 2009 at 9:35 AM, Andrew > Burnett-Thompson<[email protected]> wrote: > > I noticed osg::Camera offers more direct access to the view/projection > than > > the camera manipulator (which only affects the View), so I've dumped > camera > > manipulator and created two cameras - perspective / plan. > > Yes this would be doable, although having two separate views in > CompositeViewer might be more logical an easier to manage. > > > Then I am directly updating the camera in the perspective/plan mode from > my > > own event handling code. (In addition I need multiple other cameras that > I > > can position around the scene in perspective mode and switch to on > various > > key presses). > > > > One problem - I am trying to swap the cameras in/out of the osg::Viewer > so I > > was using osg::Viewer::setCamera and getCamera to get/set the default > > camera, however it is not behaving as expected. > > What problem are you seeing? Using the > viewer.getCamera()->set..MatrixAs..(..) methods work fine, but if you > need to make sure that you aren't also attaching a CameraManipulator > as this will overwrite your values on each frame. > > > Is this the right way to set the default camera? > > Just use the Camera that is already assigned to the Viewer. > > Robert. > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

