Version 14 (modified by robert, 9 years ago)


Getting Started

Follows is a quick step by step guide to helping new OpenSceneGraph users get up to speed on how to use the software in their own application development work.

1. Downloading the OpenSceneGraph

You may download the OpenSceneGraph as a set of binaries or source code tarballs for the current release which can be found on the Downloads page, or use SVN or Developer Releases to check out the development version of the OpenSceneGraph to get latest additions, revisions and bug fixes. For beginners we'd recommend using the binaries or the source tarballs.

2. Obtaining the pre-requisites tools/dependencies

If you plan to compile the OpenSceneGraph you'll also need to the build system generator tool CMake 2.6.x (CMake 2.4.2+ may be used on older Linux/Unix systems) and an appropriate compiler suite for your platform, i.e. VisualStudio, g++ etc. For modern linux distributions you'll be able to pull down cmake, g++ and other dependencies directly from central repositories.

You will need to download the dependencies which are listed in the Dependencies. You don't need all the dependencies for the plugins as this are all options libraries, so don't worry about trying to get all the dependencies installed, you can always add further dependencies later if it turns out you need them for your project.

When running the examples its is useful to install the Sample Dataset so that the examples have some data to load.

3. Compiling

For Linux/Unix/OSX/Mingw/Cygwin the build and install is straight forward:

cd OpenSceneGraph
sudo make install

If you have a multi-processor/core system then you can use make -j <numcores> to tell the build system to multiple cores.

For Windows you'll need to generate VisualStudio project files, for a full guide see the VisualStudio page.

There are more details on platform specific build issues/dependencies see the Support/PlatformSpecifics

4. Running the example applications

To run the applications you need to set up the path to the applications, and its recommend that you add these environmental settings to you login setup such as autoexec.bat under Windows, or .tcshrc, or .bashrc under Unix. The binaries paths to set up are:

Unix, tcsh: setenv PATH {$PATH}:/usr/local/share/OpenSceneGraph/bin

Unix, bash: export PATH={$PATH}:/usr/local/share/OpenSceneGraph/bin
Windows : set PATH=Mypath;where\I\put\my\OpenSceneGraph\bin
Windows Vista : setx PATH "%PATH;c:\apps\OpenSceneGraph\bin" (one-time command)

Then set the OpenSceneGraph file path up, so that the examples can find the data:

Unix, tcsh: setenv OSG_FILE_PATH /home/myaccount/MyData/OpenSceneGraph-Data

Unix, bash: export OSG_FILE_PATH=/home/myaccount/MyData/OpenSceneGraph-Data
OSX, use the above expressions plus : setenv DYLD_BIND_AT_LAUNCH
Windows: set OSG_FILE_PATH=where\I\put\my\OpenSceneGraph-Data
Windows Vista : setx OSG_FILE_PATH c:\apps\OpenSceneGraph-Data (one-time command)

Then to run a single application type in a console:

osgviewer cow.osg

Or to run all the examples one after the other:

cd OpenSceneGraph/ ./runexamples.bat

To advance to the next example simple press Escape, to print out help just press 'h'. If you want to have a quick look at what you should expect to see on screen browse through the Screenshots/OSGExamples. For further information of the examples also read through the Examples in the User Guides section.

5. Writing your first application

Take one of the existing examples such as osgviewer as a base and modify it.

6. Further resources

The key resources are collected together on the Support page, particular ones of interest are: