Skip to content

Latest commit

 

History

History

1.2.InstallUnderLinux

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Table of contents

This tutorial is part of OpenSceneGraph cross-platform guide.

In this tutorial we install OpenSceneGraph under Linux and take a look at the cube with osgviewer tool.

Note: this tutorial requires OpenSceneGraph model created in 1.1. Create a cube.

YouTube | Download

Video depicts OpenSceneGraph installation under Xubuntu 16.04.

Note: steps below use frames from the video as screenshots. Watch the video to see all details.

Screenshot

Find OpenSceneGraph repository at the website.

Screenshot

Since OpenSceneGraph is hosted at GitHub, we need to install git.

To install git on Debian based distributions, run the following command:

sudo apt install git

Screenshot

Get the latest copy of OpenSceneGraph with the following command:

git clone https://github.com/openscenegraph/OpenSceneGraph.git

Screenshot

OpenSceneGraph uses CMake build system, which supports out-of-source builds. We create a build directory to keep generated (built) content separate from the original source.

Screenshot

Before we can build OpenSceneGraph, we need to configure the build.

However, CMake is not yet installed.

Screenshot

To install CMake on Debian based distributions, run the following command:

sudo apt install cmake

Screenshot

Configure OpenSceneGraph build with the following commands:

cd /path/to/build/dir

cmake /path/to/source/dir

We use default configuration without specifying anything.

Screenshot

As you see, configuration process could not resolve OPENGL_INCLUDE_DIR variable. This means CMake could not find OpenGL libraries.

Screenshot

The easiest way to install OpenGL libraries is to install GLUT development package, which will bring OpenGL libraries in as a dependency.

To install GLUT development package on Debian based distributions, run the following command:

sudo apt install freeglut3-dev

Screenshot

Configure OpenSceneGraph once again. There are no OpenGL errors anymore.

Screenshot

As you see, configuration process has successfully found OpenGL libraries.

Screenshot

We are finally ready to build OpenSceneGraph with the following command:

make -j10

We use -j10 to run 10 parallel jobs. This makes building faster.

Screenshot

Install OpenSceneGraph with the following command:

sudo make install

Screenshot

Try to take a look at the cube with osgviewer tool.

Turns out, it cannot find OpenSceneGraph libraries.

Screenshot

By default, OpenSceneGraph libraries are installed into /usr/local/lib64 on 64-bit Linux distributions. This location is not standard.

Screenshot

Specify /usr/local/lib64 inside /etc/ld.so.conf to make sure dynamic linker is aware of the directory with OpenSceneGraph libraries.

Then refresh the linker cache with the following command:

sudo ldconfig

Screenshot

Finally, take a look at the cube with osgviewer tool:

osgviewer /path/to/box.osgt