- OpenSceneGraph 3.0: Beginner's Guide
- Rui Wang Xuelei Qian
- 303字
- 2021-03-27 00:35:40
Configuring environment variables
The last but not least thing to do before programming with the installed OSG is to configure some important environment variables. It is OK if you ignore this section and continue to the next chapter, but understanding what environment variables do and how to make use of them will bring about significant benefits.
Environment variables are a set of global values that may affect a program's starting behaviors. OSG has defined a number of environment variables that can be used to change its internal running states and display settings. Due to limited textual length, only the most commonly-used variables are introduced here. These are automatically set for the Current User if you are using the installer on Windows:
- OSG_FILE_PATH identifies the location of the sample data. According to the path value kept by it, OSG could directly find and read any file archived in the specified path, otherwise you may have to enter an absolute path like
C:/Programs Files/OpenSceneGraph/data/cessna.osg
. - OSG_NOTIFY_LEVEL sets a value that controls the verbosity level of debugging messages displayed by OSG. The default value is NOTICE. We will discuss this variable, and the notification mechanism, in more detail in Chapter 3, Creating Your First OSG Program.
- OSG_ROOT is not used by OSG itself. It defines the OSG installation path, which is quite useful for other independent projects that use OSG and the CMake build system.
To set environment variables manually, you can either change the profiles for permanent modification, or start the command-line shell for temporary changes during set-up. On Windows, an environment variable dialog can be found by right-clicking the My Computer icon and selecting Properties | Advanced, but to set a temporary one you can type set VARIABLE=value
in the shell before running the application. On UNIX, use start-up profiles and the export/setenv
commands instead.