Time for action—rendering more scenes at one time

Multi-viewers are practical in representing complex scenes, for instance, to render a wide area with a main view and an eagle eye view, or to display the front, side, top, and perspective views of the same scene. Here we will create three separate windows, containing three different models, each of which can be independently manipulated.

  1. Include the necessary headers:
    #include <osgDB/ReadFile>
    #include <osgViewer/CompositeViewer>
    
  2. We design a function to create a new osgViewer::View object and apply an existing node to it. The setUpViewInWindow() method is used here to produce non-full screen views:
    osgViewer::View* createView( int x, int y, int w, int h, osg::Node* scene ) { osg::ref_ptr<osgViewer::View> ...

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.