bhbn.free.fr

Home

Developments


Open Scene Graph for MS Visual Studio

Setup procedure and test application

2008
Sep
Developments
Tags : 3D graphics

Save this article in PDF

This is just a quick summary of the procedure which seems the safest to get the OSG library compiled and installed properly to develop with MS Visual Studio. Installing OSG is highly simplified if you work under Linux tough, so give it a try if you can’t manage to have it to work under Windows ;) ! NB: If you don’t have MS Visual Studio, download and install MS Visual Studio Express

Installation of the OSG library under MS Windows

  1. Install CMake (http://www.cmake.org).
  2. Download the source code zip of OSG
  3. Download the Win32 binary dependency libraries for OSG and place the files in a folder which can remain (e.g. C:/Program Files/OpenSceneGraph/3rd-party). Using SVN is the more appropriate to do so.
  4. To compile OSG:
    1. Read the instructions.
    2. Follow the instructions.
    3. To have it simpler:
      1. Uncompress the OSG zip in a place where it can stay (i.e. Desktop is not a good idea)
      2. In cmake, setup the bin install directory to C:/Program Files/OpenSceneGraph
      3. In cmake, make sure when configuring that you select the version of Visual Studio that you have.
      4. In cmake, clic configure maybe twice to ensure all is green. Clic ’Ok’ to generate the projects.
      5. In Visual Studio, compile the Release version.
  5. In fact, it does not take too long to compile (<20 minutes). Build the INSTALL project when done.
  6. Download and uncompress the OSG sample data at a place where it can remain (e.g. C:/Program Files/OpenSceneGraph/OpenSceneGraph-Data)
  7. Setup the environment variable PATH (or Path) of your system to contain the path to where the binaries of OSG have been installed: it should be C:/Program Files/OpenSceneGraph/bin. Setup the other OSG_ environment variables as specified. Log out/log in again.
  8. Test the OSG viewer: open the command line (cmd), navigate to where you have the sample data set (or make sure the OSG_FILE_PATH environment variable is set) and execute ’osgviewer cow.osg’. You should see the cow! If so, you are done with the installation of OSG!
PNG - 47.5 kb
The famous OSG cow
Execute ’osgviewer cow.osg’ to test your OSG installation.

Making a test program for OSG

To make your own program;

  • I made a little CMake project which should work for Linux and Windows (Uncompress and read the README):
    Zip - 2.9 kb
    OSGTest
    • run cmake in the osgTest directory (ccmake . in a linux console). This should produce a Makefile (linux) or a Visual Studio project (Windows)
    • Compile the program (e.g. with make). If you do not want to use CMake;
  • It is a bad idea to copy an existing MS Visual Studio dsp project from OSG installation because they are all linked into the global library solution, and even a physical copy of the .dsp files keeps references to the library and may alter the installation of OSG.
  • Better create a blank new console application, specifying the OSG include and lib directories and linking with the osg libraries and the osg dependency libraries. An example of such MS Visual Studio solution can be found here:
    Zip - 881.6 kb
    OSGTest Visual Studio Project

Programming using OSG


SPIP | template | | Site Map | Follow-up of the site's activity RSS 2.0