If you would like to install OpenSceneGraph on windows, and would like to add necessary paths to system variables automatically, you can use a batch file to save your day. The procedures will be quite simple 2-step job:
- Download OSG from this page, where you can select downloading source vs binary files. I would prefer to download binary one, as I barely need to touch on the source code.
- Run below OsgPath.Bat:
setx OSG_ROOT c:\OSG301
setx OSG_BIN_PATH %OSG_ROOT%\bin
setx OSG_INCLUDE_PATH %OSG_ROOT%\include
setx OSG_LIB_PATH %OSG_ROOT%\lib
setx OSG_SAMPLES_PATH %OSG_ROOT%\share\OpenSceneGraph\bin
setx OSG_FILE_PATH %OSG_ROOT%\data
setx Path “%Path%;%OSG_BIN_PATH%;%OSG_SAMPLES_PATH%;” /m
That is it. Note that:
- You need to change “c:\OSG301” to whatever directory you installed OSG.
- In the penultimate line, you have the choice of using “/m”, which set the path for current user, all for the whole machine (without /m).
Now open a cmd window, and type “osgversion”, you will find that it works well!