/ osgviewer

OpenSceneGraph

Documentation

osgviewer

osgviewer is the basic scene graph viewer distributed with OpenSceneGraph. Its primary purpose is an example of how to write a simple viewer, but it is also functional enough to use as a basic 3D graphics viewer.

Environmental settings

Ensure that the paths to the OpenSceneGraph libraries and applications are set.

Running osgviewer

In a console window type:

osgviewer cow.osg

This will open up the viewer full screen.

Command line options

To print out the command line options available, in a console window type:

osgviewer --help
Options:
--dem <filename> Load an image/DEM and render it on a HeightField
--display <type> MONITOR | POWERWALL | REALITY_CENTER | EAD_MOUNTED_DISPLAY
--help-all Display all command line, env vars and keyboard & mouse bindigs
--help-env Display environmental variables available
--help-keys Display keyboard & mouse bindings available
--image ;filename> Load an image and render it on a quad
--rgba Request a RGBA color buffer visual
--run-till-elapsed-time Specify the about of time to run
--run-till-frame-number <integer> Specify the number of frame to run
--stencil Request a stencil buffer visual
--stereo Use default stereo mode which is ANAGLYPHIC if not overriden by environmental variable
--stereo <mode> ANAGLYPHIC | QUAD_BUFFER | HORIZONTAL_SPLIT | VERTICAL_SPLIT | LEFT_EYE | RIGHT_EYE | ON | OFF
-O <option_string> Provide an option string to reader/writers used to load databases
-c <filename> Specify camera config file
-e <extension> Load the plugin associated with handling files with specified extension
-h or --help Display command line paramters
-l <library> Load the plugin
-p <filename> Specify camera path file to animate the camera through the loaded scene

Keyboard and mouse bindings

When running osgviewer to print out the keyboard and mouse bindings simply press 'h' to toggle them, then 'h' again to toggle them off. Or to print the keyboard mouse options to a console window tyoe:

osgviewer --help-keys
Keyboard and Mouse Bindings:
1 Select 'Trackball' camera manipulator (default)
2 Select 'Flight' camera manipulator
3 Select 'Drive' camera manipulator
4 Select 'Terrain' camera manipulator
5 Select 'UFO' camera manipulator
Drive: Space Reset the viewing position to home
Drive: a Use mouse middle,right mouse buttons for speed
Drive: q Use mouse y for controlling speed
Escape Exit the application
Flight: Space Reset the viewing position to home
Flight: a No yaw when banked
Flight: q Automatically yaw when banked (default)
O [=PrnScn?=] Write camera images to "saved_image*.rgb"
Trackball: + When in stereo, increase the fusion distance
Trackball: - When in stereo, reduse the fusion distance
Trackball: Space Reset the viewing position to home
UFO: Please see http://www.openscenegraph.org/html/UFOCameraManipulator.html
UFO: H Reset the viewing position to home
Z If recording camera path stop recording camera path, save to "saved_animation.path"
  Then start viewing from being on animation path
b Toggle backface culling
f Toggle fullscreen
h Display help
l Toggle lighting
s Toggle instrumention
t Toggle texturing
v Toggle block and vsync
w Toggle polygon fill mode between fill, line (wire frame) and points
z Start recording camera path.

Environmental variable settings

To print out the command line options available, in a console window type:

osgviewer --help-env
Environmental Variables:
OSG_COMPUTE_NEAR_FAR_MODE <mode> DO_NOT_COMPUTE_NEAR_FAR | COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES | COMPUTE_NEAR_FAR_USING_PRIMITIVES
OSG_DISPLAY_TYPE <type> MONITOR | POWERWALL | REALITY_CENTER | HEAD_MOUNTED_DISPLAY
OSG_EYE_SEPARATION <float> physical distance between eyes
OSG_FILE_PATH <path>[:path].. Paths for locating datafiles
OSG_LIBRARY_PATH <path>[:path].. Paths for locating libraries/ plugins
OSG_MAX_NUMBER_OF_GRAPHICS_CONTEXTS <int> maximum number of graphics contexts to be used with applications.
OSG_NEAR_FAR_RATIO <float> Set the ratio between near and far planes - must greater than 0.0 but less than 1.0.
OSG_OPTIMIZER "<type> [<type>]" OFF | DEFAULT | FLATTEN_STATIC_TRANSFORMS | REMOVE_REDUNDANT_NODES | COMBINE_ADJACENT_LODS | SHARE_DUPLICATE_STATE | MERGE_GEOMETRY | SPATIALIZE_GROUPS | COPY_SHARED_NODES | TRISTRIP_GEOMETRY | OPTIMIZE_TEXTURE_SETTINGS
OSG_SCREEN_DISTANCE <float> physical distance between eyes and screen
OSG_SCREEN_HEIGHT <float> physical screen height
OSG_SPLIT_STEREO_AUTO_ADJUST_ASPECT_RATIO <mode> OFF | ON Default to ON to compenstate for the compression of the aspect ratio when viewing in split screen stereo. Note, if you are setting fovx and fovy explicityly OFF should be used.
OSG_SPLIT_STEREO_HORIZONTAL_EYE_MAPPING <mode> LEFT_EYE_LEFT_VIEWPORT | LEFT_EYE_RIGHT_VIEWPORT
OSG_SPLIT_STEREO_HORIZONTAL_SEPARATION <float> number of pixels between viewports
OSG_SPLIT_STEREO_VERTICAL_EYE_MAPPING <mode> LEFT_EYE_TOP_VIEWPORT | LEFT_EYE_BOTTOM_VIEWPORT
OSG_SPLIT_STEREO_VERTICAL_SEPARATION <float> number of pixels between viewports
OSG_STEREO <mode> OFF | ON
OSG_STEREO_MODE <mode> QUAD_BUFFER | ANAGLYPHIC | HORIZONTAL_SPLIT | VERTICAL_SPLIT | LEFT_EYE | RIGHT_EYE
PRODUCER_CAMERA_CONFIG_FILE <filename> specify the default producer camera config to use when opening osgProducer based applications.