-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
OpenSceneGraph 3.0: Beginner's Guide
The simulation loop defined by the run() method always has three types of tasks to perform: specify the main camera's manipulator, set up associated graphics contexts, and render frames in cycles.
The manipulator can read keyboard and mouse events and accordingly adjust the main camera's view matrix to navigate the scene graph. It is set by using the setCameraManipulator() method, of which the parameter must be an osgGA::CameraManipulator subclass. For example:
viewer.setCameraManipulator( new osgGA::TrackballManipulator );
This adds a classic trackball (arc ball) manipulator to the viewer object, with free motion behaviors. Because the camera manipulator is kept as a smart pointer in the viewer, we can assign a new manipulator by using the setCameraManipulator() method at any time. Some in-built manipulators defined in the osgGA namespace can be found in the following table:
|
Manipulator class |
Description |
Basic usage |
|---|---|---|
|
|
Drive-like simulator... |
Change the font size
Change margin width
Change background colour