Digging into the simulation loop

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 ...

Get OpenSceneGraph 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.