OpenSceneGraph

From FlightGear wiki
(Redirected from Open Scene Graph)
Jump to navigation Jump to search
An UML class diagram disclosing the associations between some classes of the FlightGear source code.

OpenSceneGraph (OSG) is an open source 3D graphics application programming interface, used by FlightGear since version 1.9.0 (2008), when it replaced PLIB. While much of the conversion to OSG has happened over the years, PLIB is still used for some functions. As of 2022, the OSG project has moved all development effort to its successor VulkanSceneGraph (VSG). FlightGear has not yet made the switch to VSG.

Downloading OpenSceneGraph

Because the OSG project is no longer officially maintained, current versions of FlightGear require a forked version of OSG that comes with several improvements and fixes. The fork is hosted on https://gitlab.com/flightgear/openscenegraph, with a specific branch for specific versions of FlightGear, as outlined in the table.

FlightGear major version OSG branch
2020 OpenSceneGraph-3.6
2024 release/2024-build
Next next

Compiling OpenSceneGraph

A minimal build instruction for unix systems is

mkdir build.osg
cd build.osg
cmake ../path/to/osg/source
make
make install

On other systems the steps might be different.

Recommended options to set in the cmake menus:

  • Build type: Release
  • You don't need to build the examples, wrappers or applications.

Installing OpenSceneGraph and FlightGear with --prefix

If you use --prefix to choose were to install FlightGear and do not want to install OSG globally on the system this can be done with the following method:

OpenSceneGraph uses cmake so to build it do

 mkdir build.osg
 cd build.osg
 cmake -D CMAKE_BUILD_TYPE="Release" -D CMAKE_CXX_FLAGS_RELEASE="-O3 -pipe" -D CMAKE_C_FLAGS_RELEASE="-O3 -pipe" \
       -D CMAKE_INSTALL_PREFIX:PATH="${MY_PREFIX}" ../path/to/osg/source
 make
 make install

or if you want to avoid needing to set LD_LIBRARY_PATH

 mkdir build.osg
 cd build.osg
 cmake -D CMAKE_BUILD_TYPE="Release" -D CMAKE_CXX_FLAGS_RELEASE="-O3 -pipe" -D CMAKE_C_FLAGS_RELEASE="-O3 -pipe" \
       -D CMAKE_INSTALL_PREFIX:PATH="${MY_PREFIX}" -D CMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOLEAN="true" ../path/to/osg/source
 make
 make install

Configure and build SimGear and FlightGear with --prefix as usual.

No need to install any quickly changing software globally.

Installing with --prefix is a very nice way to keep several distinct and independent versions of FlightGear around. To start a new $PREFIX directory you'll also need to install plib in it, but that is easy. Most other needed dependencies are usually available through the package system of most Linux distributions (e.g. FreeGLUT, SDL, ALSA, etc).

External link