OpenSceneGraph 3.0: Beginner's Guide
上QQ阅读APP看书,第一时间看更新

Time for action—installing OSG

The installer is designed to make the installation process flow more efficiently. If you are not familiar with the process of compiling a project from source code, or just want to have an initial impression of the OSG utilities, the following instructions may help you to install an OSG development environment step by step by using the installer.

Note that only Microsoft Windows developers can benefit from the installer at present. Users of Linux, Mac OS X, and other systems should refer to the Cross-platform building section.

  1. Start the installer and you will see the Choosing Language dialog, the Welcome page, and the License Agreement page. Read the OpenSceneGraph license carefully, select I accept the terms of the License Agreement, then click on Next to continue:
    Time for action—installing OSG
  2. If you have already installed a previous OSG version, the installer will pop up a warning dialog box and ask if you want to continue with the installation, or quit and uninstall the old version first. Please note that it may cause unexpected trouble if you have different versions of OSG installed on the same machine, because an application developed with one specific OSG version may incorrectly link to shared libraries created by another during the linking process. To avoid link errors or runtime exceptions, each time before you install a new version of OSG, it is suggested that you remove the old version, because OSG is backwards compatible. Here we assume it is the first time that you installed OSG; please select Yes to ignore and continue:
    Time for action—installing OSG
  3. There will be one or more distributions listed on this page, in addition to an entry panel for selection of the Visual C++ product directory. Select a distribution and specify the C++ working directory and click on Next.

    Make sure that the displayed building environment of the item goes with your system and development settings. For example, you should have installed Visual Studio 2008 Service Pack 1 on a 32-bit Windows XP system, in order to make use of the OSG 3.0 prebuilt packages shown in the following image, either with dynamic debug or release configuration.

    Time for action—installing OSG
  4. The massage box below will show up if the processor architecture, operating system, or the IDE is mismatched with the distribution's requirements. Don't ignore it unless you have specific requirements and know what will happen.
    Time for action—installing OSG
  5. Now it is time to decide the components to be installed, which have been classified into eight categories by the installer. Users are allowed to select one or more of them according to their individual requirements. A grayed out (disabled) section means that that part is not included in the current distribution:
    • Binaries: Core runtime libraries (DLL), key plugins and utilities, which will be placed in the bin subdirectory of the installation directory.
    • Developer files: Headers and static-link libraries for developing OSG-based applications, placed in the include and lib subdirectories.
    • Extra plugins: Extra plugins and related runtime dependencies, which will be placed in the bin subdirectory. A list of supported file I/O plugins can be found in Chapter 10,
    • Sample data: Sample datasets for demonstrations and experiments. Some of the sample data will be used many times in this book. It will be installed in the data subdirectory.
    • Documentation: The API documentation in HTML help file format (.chm), which will be easy to read on Windows platforms.
    • Examples: A great deal of useful examples and tests, installed in the examples subdirectory of the installation directory.
    • Visual Studio project wizard: See Using the project wizard for details. Be sure to select this.
    • Environment variables: See Configuring environment variables below, for details. Be sure to select this, unless you have already had other OSG distributions on your computer and have set the environment variables yourself.
    Time for action—installing OSG
  6. What we need to do in the next few steps is quite simple: decide upon the installation directory, specify the start menu folder, and launch the installation! Make sure the Internet connection remains alive during the entire installation process.
  7. Click on Finish and if everything progresses well, you will see a Cessna model in the middle of a deep blue background. This installer's demo is actually what Chapter 1, The Journey into OpenSceneGraph is going to demonstrate in the "Hello World" example!
    Time for action—installing OSG

What just happened?

The installer will generate a few subdirectories under the installation directory (hereafter INSTDIR) and copy files into those subdirectories. Binaries and plugins will be copied to INSTDIR/bin, header files to INSTDIR/include, static-link libraries to INSTDIR/lib, sample data to INSTDIR/data, documentation to INSTDIR/doc, and examples to INSTDIR/share.