1: 安装必备依赖库: sudo apt-get build-dep openscenegraph
2:安装OpenGL库: sudo apt-get install mesa-common-dev freeglut3 freeglut3-dev
3: 下载源码最新的release 版本: http://www.openscenegraph.org/index.php/download-section/stable-releases
4:解压后进入目录,依次运行:
./configure (如果提示须 sudo make install_ld_conf, 则运行这个命令)
make
sudo make install
ldconfig
5: 运行检查是否安装好, osgversion。
如果运行samples, 请参考这个
Running the examples
- Category: User Guides
- Published on 13 February 2013
- Written by openscenegraph
- Hits: 22561
The OpenSceneGraph has an ever growing number of examples available for developers to learn from. Following is a guide to getting these examples running.
Once the OpenSceneGraph is installed you will need to place the location where it was installed on the system paths environmental variables. Also download the demo data and set the OSG_FILE_PATH environment variable so that the example datasets can be found by OSG. It is probably worth setting your autoexec.bat, .bashrc, .tcsh, etc to pick up on these settings so that next time you log in everything is in easy reach. Below are examples for the different platforms on how to set up your environment. The examples are not built by default, use the cmake utility and set the option to enable building of the example applications. To build them, run cmake with the following parameter: -DBUILD_OSG_EXAMPLES=1
- Windows:
set PATH=path;C:\OpenSceneGraph\bin set OSG_FILE_PATH=C:\OpenSceneGraph-Data;C:\OpenSceneGraph-Data\Images
- Unix - bashrc:
export PATH = ${PATH}:/home/myaccount/OpenSceneGraph/bin export LD_LIBRARY_PATH = ${LD_LIBRARY_PATH}:/home/myaccount/OpenSceneGraph/lib export OSG_FILE_PATH = /home/myaccount/OpenSceneGraph-Data:/home/myaccount/OpenSceneGraph-Data/Images
- Unix - tcsh:
setenv PATH ${PATH}:/home/myaccount/OpenSceneGraph/bin setenv LD_LIBRARY_PATH = ${LD_LIBRARY_PATH}:/home/myaccount/OpenSceneGraph/lib setenv OSG_FILE_PATH /home/myaccount/OpenSceneGraph-Data:/home/myaccount/OpenSceneGraph-Data/Images
- MacOSX:
setenv PATH "${PATH}:${OSGHOME}/lib:${OSGHOME}/lib/osgPlugins" setenv DYLD_LIBRARY_PATH "${OSGHOME}/lib:${OSGHOME}/lib/osgPlugins" setenv DYLD_BIND_AT_LAUNCH setenv OSG_FILE_PATH "/home/myaccount/OpenSceneGraph-Data:/home/myaccount/OpenSceneGraph-Data/Images"
All the examples run from the command-line. Most require parameters to be passed, such as what file to load. If you are in any doubt just run the application and it will either run, or provide help on what options it accepts. You can also print out full help my running the example with the option --help.
To run the examples in quick succession on Windows, use the runexamples.bat script which can be found in the the root of the OpenSceneGraph distribution:
./runexamples.bat
Press Escape to close each application and move on to the next application. On Unix, you should be able to use
sh ./runexamples.bat