There are two ways to compile VR Juggler applications: from the command line or with Microsoft Visual Studio. Compiling an application at the command line will work on all supported platforms including Win32. Using Microsoft Visual Studio will only work on Win32.
All the sample programs in $VJ_BASE_DIR/share/samples use the same basic steps to compile unless otherwise noted. Always refer to the top of the sample application's Makefile for information that may be specific to building that application. In general, though, all applications' makefiles are compatible with the standard version of the make(1) utility. This includes the nmake command provided with Visual C++.
The example used here will be the Torus application found in $VJ_BASE_DIR/share/samples/ogl/torus. It is an OpenGL-based application that will compile and run on all platforms supported by VR Juggler. Begin by changing into the directory $VJ_BASE_DIR/share/samples/ogl/torus in a command shell.
To compile Torus, simply enter the following:
% make
or on Win32 without Cygwin, enter:
% nmake
The compile process will then begin. If you have your system set up properly, it will complete with an executable torus file (or torus.exe on Win32) in the directory. Now that you have a program compiled, it is time to learn how to run it. Readers who are not using Visual Studio can skip ahead to Chapter 5.
All OpenGL sample applications are shipped with pre-configured Microsoft Visual C++ workspaces. This is done to help new users get started with compiling VR Juggler applications and to give experienced Visual Studio users a starting place for their application development. To use the workspace for the Torus application, begin by opening the folder containing the source code and double-clicking on torus.dsw.
Visual C++ will open, and the Torus project will be loaded. The unexpanded class view will appear as shown in Figure 4.2 when Visual C++ first loads.
Before proceeding, the program arguments must be set. This is done using the Settings item under the Project menu. This is shown in Figure 4.3.
Selecting this item opens the “Project Settings” dialog, shown in Figure 4.4. In this window, choose the Debug tab. There will be an empty text entry field under the heading Project arguments. Here, enter the full paths to the VR Juggler configuration files that will be used to run the torus application. The VJ_BASE_DIR environment variable cannot be used here, unfortunately, so the full path to every file must be used. The following shows the beginning of the program arguments listing sim.base.config, sim.wand.mixin.config, and sim.displays.config:
Note that in this example, the / directory separator is used instead of \ for the program arguments. This is not strictly required in this case, but doing it this way maintains consistency with other examples.
Once the program arguments are set up, compile the application. Under the Build menu, choose the Build torus.exe item as shown in Figure 4.5.
Visual C++ will compile the application, and if you have everything configured properly on your computer, the compiling will complete successfully. Once it is done, execute the torus program by choosing the Execute torus.exe item from the Build menu, shown below in Figure 4.6.