- Category: Knowledge Base
- Published on 18 January 2013
- Written by openscenegraph
- Hits: 1203
There is a history and rationale behind the library. This page is meant to describe how to use the current Viewers and Views.
When choosing an OpenSceneGraph provided Viewer, one has two choices: Viewer or CompositeViewer. Both are derived off of osgViewer::ViewerBase. ViewerBase provides functionality such as controlling stats, threading, and frame calls.
themselves can contain multiple . Among other things, Views control a , , , and .
along with being a ViewerBase is also a View. This simplifies the setup and interface if one is interested in a single view.
, in contrast with Viewer, actually contains a list of multiple Views. This gives more versatility to the programmer but with more work to access View functionality.
Which Viewer to Use
So which Viewer class is right for your app? This is discussed in detail on this page.
Windows are created for eachcreated. When using some of helper funcions for osgView::View, such as setUpViewAcrossAllScreens(), setUpViewOnSingleScreen(), or setUpViewInWindow(), the graphics context with a new window will be created for each call. Therefore, using some combination of these calls with a CompositeViewer with multiple Views would produce multiple windows. If one did not want multiple windows or maybe didn't want window decorations, one can setup the themselves. A single window with multiple views can be achieved by setting Traits::sharedContext to a previously created context. And, the decorations can be turned of with Traits::windowDecoration set to false.
Examples of setting up windows and contexts can be found in the osgwindows and osgcamera examples among others.