Version 1 (modified by jean-sebastien.guay, 3 years ago)

Initial creation

The following presentations were given at the Siggraph 2011 OpenSceneGraph Birds of a Feather:

Other activities

Jean-Sébastien Guay gave a short tutorial session about how to compile OpenSceneGraph itself, and then how to set up your own project using this. The steps followed were roughly:

OpenSceneGraph

# Download OpenSceneGraph sources (from svn or a source zip file of the version you want to use) # Download relevant dependencies (on Windows, dependencies packages for most versions of Visual Studio are available; on Linux, install the -dev or -devel versions of the dependencies you want to build against; on MacOS X, use MacPorts? to install the dependencies; if you want to use non-standard or less-used dependencies, it may be non-trivial, but that is up to the developers of the 3rdparty project itself, OSG cannot really do anything beyond make the CMake config find the appropriate files; there was lots of discussion / concern about the VRML plugin so that may have to be looked into) # Run CMake GUI, drag and drop the root CMakeLists.txt onto it, change the build directory to (source tree)/build, click Configure. # Activate / show Advanced settings and check that the relevant 3rdparty dependencies were found. On Linux / MacOS X they generally are, on Windows they generally are not since there is no standard place to look, so you will have to fill in the header / library paths. # Also enable Build OSG Examples and other things you may want. # Change CMAKE_INSTALL_PREFIX to where you want to install the binaries once they're built. # Click Configure as many times as you need to for all red fields to be gone, then click Generate. # In the build directory you specified in step 3, on Linux do make install, for Visual Studio open the OpenSceneGraph.sln file and right-click the INSTALL target and build that, on XCode open the generated project and build it.

Simple OSG-based project skeleton

# Download the skeleton # Unzip the file somewhere. # Run CMake GUI, drag and drop the root CMakeLists.txt onto it, change the build directory to (source tree)/build, click Configure. # Set OSG Install Type to Alternative Installation Directory, click Configure again. # In OSG Install Directory browse to the install path that you set in CMAKE_INSTALL_PREFIX when you built OpenSceneGraph above. # Change CMAKE_INSTALL_PREFIX to where you want to install the binaries once they're built. # Click Configure as many times as you need to for all red fields to be gone, then click Generate. # In the build directory you specified in step 3, on Linux do make install, for Visual Studio open the OpenSceneGraph.sln file and right-click the INSTALL target and build that, on XCode open the generated project and build it.

The simple project you can download above is simply the source of the osgviewer application, as a starting point. The important part is the CMake configuration, which is basically 3 files: the root CMakeLists.txt, the one in the src directory, and the OSGHelper.cmake in the CMakeModules directory (which is from osgworks, thanks Paul Martz for this really good helper which hides all the redundant settings and lets you set the OSG binaries path in a clean and user-friendly fashion).

Some additional notes on the process above

(from questions I answered at the BOF)

  • As you can see, compiling OSG from source is not harder than compiling any other CMake project, which is pretty easy once you get the basic mechanics of the process. I really recommend building from source with a basic set of plugins / 3rdparty dependencies, and adding others as you need later. You can always come back to your build directory later and all your previous settings in CMake will have been preserved, so you can just add one plugin and regenerate the build files and you will be able to just compile that plugin.
  • For your own projects, using CMake is not mandatory. I use it and I showed this way of doing things because I could show one way that was valid on all platforms, and I personally use it so that my own projects are cross-platform, but if you want to make your own Makefiles, or Visual Studio projects, or whatever, just adjust your header paths and link to the libraries you need and you will be set.

Beginner's Guide Giveaway

Four electronic copies of the OpenSceneGraph Beginner's Guide book were given away in a draw from the business cards of the people who were present at the end of the tutorial. Thanks to Wang Rui for providing these complimentary copies!

Videos

Photos

Attachments