- Overview
- Video
- Steps
- 1.6.1. Get sample application
- 1.6.2. Create build directory
- 1.6.3. Configure the build
- 1.6.4. Try to build application
- 1.6.5. Observe build error
- 1.6.6. Find OpenSceneGraph include directory
- 1.6.7. Reconfigure with OSG include directory
- 1.6.8. Try to build application once again
- 1.6.9. Observe another build error
- 1.6.10. Reconfigure with OSG include and library directories
- 1.6.11. Build application
- 1.6.12. Try to run application
- 1.6.13. Observe missing library
- 1.6.14. Copy OSG libraries
- 1.6.15. Run application
This tutorial is part of OpenSceneGraph cross-platform guide.
In this tutorial we build and run sample OpenSceneGraph application under Windows. The application displays provided model with simple GLSL shaders.
Note: this tutorial requires
- OpenSceneGraph model (see 1.1. Create a cube)
- OpenSceneGraph installation (see 1.3. Install OpenSceneGraph under Windows)
Video depicts running and building sample OpenSceneGraph application under 64-bit Windows 7.
Note: steps below use frames from the video as screenshots. Watch the video to see all details.
Get the latest copy of sample application with the following command:
git clone https://github.com/OGStudio/openscenegraph-cross-platform-guide-application.git
Create a separate build directory for sample application, just as you did for OpenSceneGraph.
Configure sample application build with the following commands:
cd /path/to/build/dir
cmake -G "MinGW Makefiles" /path/to/source/dir
Try to build application with the following command:
mingw32-make
Building process could not find one of OpenSceneGraph headers, because OpenSceneGraph is installed in a non-standard directory.
Locate OpenSceneGraph include directory and copy its path.
Reconfigure sample application build with the following command:
cmake -G "MinGW Makefiles" -DOSG_INC_DIR="C:\Program Files (x86)\OpenSceneGraph\include" /path/to/source/dir
Application's CMake file uses OSG_INC_DIR
to search for additional headers.
Try to build application with the following command once again:
mingw32-make
Building process could not find OpenSceneGraph libraries, because OpenSceneGraph is installed in a non-standard directory.
Reconfigure sample application build with the following command:
cmake -G "MinGW Makefiles" -DOSG_INC_DIR="C:\Program Files (x86)\OpenSceneGraph\include" -DOSG_LIB_DIR="C:\Program Files (x86)\OpenSceneGraph\lib" /path/to/source/dir
Application's CMake file uses OSG_LIB_DIR
to search for additional libraries.
Build sample application with the following command:
mingw32-make
Try to run sample application.
Sample application cannot be run, because it cannot find OpenSceneGraph libraries.
Copy osgPlugins directory and all files with dll
extension to the directory,
where sample application resides.
Note: you don't really need all OpenSceneGraph libraries. We copy all libraries just to keep this tutorial simpler.
Run sample application with the following command:
./sampleApplication /path/to/box.osgt