Running an Application with a Simulator Configuration

Running in “simulator mode” means that your input is simulated and your display windows may have limited functionality. (By “simulated input”, we mean that input is provided through windows that take keyboard and mouse input and translate that into transformations in the virtual world.) Simulator viewports are limited primarily in that they cannot display stereo graphics. It is important to note that a simulator viewport is a special kind of VR Juggler viewport within a display window. Instead of basing its viewpoint on the head position of one of the users, the viewpoint is controlled by a separate camera that is just another positional device. Within a simulator viewport, VR Juggler draws certain objects to help visualize the environment. For example, the heads of users are represented as blue ellipsoids with gray eyes, and a wand (if present) is drawn as a green pointing device. Besides these common simulator objects, display surfaces can be drawn. These represent projection screens or HMD viewing projections and are drawn as translucent rectangles.

As mentioned, several simulator configuration files are provided with a VR Juggler distribution. These files provide a complete simulation of an immersive environment. Please note that this documentation reflects the state of the configuration files at the time the documentation was written. For more information about the configuration files and how to view or modify the configuration, refer to the VRJConfig Guide. (Using VRJConfig is the best way to find out how a specific configuration file is set up.) The configuration files of interest for simulator mode are as follows:

For the MPApp application, we need the base configuration file and the wand mix-in configuration file.

Starting the Application

Now it is time to run the application—finally! Make sure that all your environment variables are set properly before trying to start the application. Once you are ready, specify the name of the application and all the configuration files it needs. An example of this is:

% MPApp sim.base.jconf sim.wand.mixin.jconf

You will notice that no paths are specified for finding the configuration files. The full paths to the configuration files is not necessary because the default search path will correctly find these files in $VJ_BASE_DIR/share/vrjuggler/data/configFiles. Beginning users will typically want to reference the example configuration files in that directory. As you get more comfortable with VR Juggler and its configuration system, you may want to make your own modified files and put them in the directory $HOME/.vjconfig. The environment variable VJ_CFG_PATH is useful in providing a search path for finding your configuration files. (Refer to the section called “Optional Related Environment Variables” for more information on using VJ_CFG_PATH). To simplify running applications, you may want to make a shell script (or batch file as appropriate) that does all the work of passing configuration files and common command-line arguments.

As the application starts, you will see a status output printed to the console (more or less depending on how you have VPR_DEBUG_NFY_LEVEL, VPR_DEBUG_ALLOW_CATEGORIES, and VPR_DEBUG_DISALLOW_CATEGORIES set), and then one moderately sized simulator display window will open on the left side of your screen while three blank keyboard input windows open on the right side of your screen. The display window will be titled “SimWindow1”, and the keyboard input windows will be titled “Head Keyboard”, “Sim View Cameras Control” and “Wand Keyboard” (in order from the top of the display to the bottom). Do not worry that the keyboard windows are black—that is normal. The display window will have an animated blue mesh, a cyan ellipsoid, and a green pointer. The mesh is what you have come to see; the ellipsoid is the user's head; and the pointer is the user's hand. In Figure 5.1, “MPApp running on a Linux desktop with multiple input windows”, we show what this looks on a RedHat Linux 7.2 desktop for comparison with what you are seeing. Note that the head and wand are only rendered in the simulator windows. They are present because head and wand input are being simulated, and it is typically quite helpful to see the results of that simulated input. To exit the application, press ESC in the window titled “Head Window”.

Figure 5.1. MPApp running on a Linux desktop with multiple input windows

MPApp running on a Linux desktop with multiple input windows

With VR Juggler 1.1/2.0, it is possible to use a single window for graphics and for input. To use such a configuration, execute MPApp as follows:

% MPApp standalone.jconf

This time, only a single window opens, as shown in Figure 5.2, “MPApp running on a Linux desktop with one window”. It shows the same graphics as before, but now it is configured to take keyboard and mouse input. To exit, press ESC in the graphics window.

Figure 5.2. MPApp running on a Linux desktop with one window

MPApp running on a Linux desktop with one window

Running an Application on Windows from Within Visual Studio

To run MPApp from within the Visual Studio IDE, the program arguments must be set first. This is done by opening the properties dialog for the project. In this dialog box, choose the Debugging item. There will be an empty text entry field under the heading Command Arguments. Here, enter the full paths to the VR Juggler configuration files that will be used to run the torus application. To use the VJ_BASE_DIR environment variable (or any other environment variable), makefile syntax must be used. In other words, to load somefile.jconf, use $(VJ_BASE_DIR)\share\vrjuggler\data\configFiles\somefile.jconf. As was stated above, the full path need not be specified, so referencing VJ_BASE_DIR in the path to the example configuration files will not be necessary in most cases.. In Figure 5.3, “Setting Command Arguments”, we see the use of standalone.jconf as the single command argument to MPApp.

Figure 5.3. Setting Command Arguments

Setting Command Arguments

With the application already compiled, execute the MPApp program by choosing the Start item from the Debug menu, shown below in Figure 5.4, “Execute MPApp.exe.

Figure 5.4. Execute MPApp.exe

Execute MPApp.exe

Running an Application on Mac OS X with the X Window System

Running a VR Juggler application on Mac OS X is slightly different if VR Juggler was compiled against X11 for OS X. Before starting the VR Juggler application, X11 must be running. This can be accomplished by double-clicking on the X11 icon in the Applications folder. By default, X11 will open a standard xterm when it starts. In this xterm, the $DISPLAY environment variable will be set correctly, and it is recommended that VR Juggler applications be launched from this xterm. From this xterm, set the necessary environment variables as described earlier in the section called “Required Environment Variables”. Once this is done, the application can be executed from the command line just as described in the previous section.

MPApp is shown executing on a Mac OS X desktop in Figure 5.5, “MPApp running on Mac OS X using X11 with one window”. Note that in the dock, the X11 icon is activated and that the application menu is for an X11 application. This truly is an X11 application running on OS X.

Figure 5.5. MPApp running on Mac OS X using X11 with one window

MPApp running on Mac OS X using X11 with one window

Basic Desktop Configuration Controls

So now you are probably wondering what you can do with this fancy application. Both of the preceding configurations use the same keyboard/mouse mappings; they vary only in which windows accept the keyboard and mouse input. Using the multi-window configuration, head movement is done with the keyboard in “Head Keyboard”; camera movement is done with the keyboard in “Sim View Cameras Control”; and wand movement is done with the keyboard and mouse in “Wand Keyboard”. Using the single-window configuration, all input is done with the keyboard and mouse in “Sim Window”. Note, however, that for the single-window configuration, the camera is attached to the user's head for an over-the-shoulder view, and hence, it does not move separately from the head. For information on how to verify these settings and to view the current configuration, refer to the VRJConfig Guide. The following list of tables provides all the keyboard and mouse controls for the simulator when using these particular configuration files. Note that it is possible to reconfigure the simulator to suit your preferences. This is provided mainly for those who just want something that works now.

Table 5.1. Moving the simulated head

TransformationKey Press
Move head backward2 on keypad
Move head left4 on keypad
Move head right6 on keypad
Move head forward8 on keypad
Move head down7 on keypad
Move head up9 on keypad
Turn head upCTRL+2 on keypad
Turn head leftCTRL+4 on keypad
Turn head rightCTRL+6 on keypad
Turn head downCTRL+8 on keypad
Rotate head clockwise1 on keypad
Rotate head counter-clockwise3 on keypad

Table 5.2. Moving the simulated wand

TransformationMouse Input/Key Press
Move wand backwardALT+move mouse backward
Move wand forwardALT+move mouse forward
Move wand leftCTRL+move mouse left
Move wand rightCTRL+move mouse right
Move wand upCTRL+move mouse forward
Move wand downCTRL+move mouse backward
Rotate wand leftSHIFT+move mouse left
Rotate wand rightSHIFT+move mouse right
Rotate wand upSHIFT+move mouse backward
Rotate wand downSHIFT+move mouse forward
Rotate wand clockwiseRight arrow
Rotate wand counter-clockwiseLeft arrow
Wand button #1Left mouse button
Wand button #2Middle mouse button
Wand button #3Right mouse button
Wand button #44
Wand button #55
Wand button #66

Table 5.3. Moving the camera (multi-window configuration only)

TransformationKey Press
Move camera backward2 on keypad
Move camera left4 on keypad
Move camera right6 on keypad
Move camera forward8 on keypad
Move camera down7 on keypad
Move camera up9 on keypad
Turn camera upCTRL+2 on keypad
Turn camera leftCTRL+4 on keypad
Turn camera rightCTRL+6 on keypad
Turn camera downCTRL+8 on keypad
Rotate camera clockwise1 on keypad
Rotate camera counter-clockwise3 on keypad

Before continuing on to running an application in a full-scale VR system, we provide two asides: using a simulated glove and using a simulated analog device. The examples provided thus far have not discussed this because the information was not relevant to the particular sample application being used. Knowing how to use these simulated devices is important, however, and it is treated separately as a reference for your future endeavors in running VR Juggler applications.

Using a Simulated Glove

If you include the sim.glove.mixin.jconf file, your application will also have access to a simulated glove, with position and gesture inputs. The glove is controlled by a window titled “Glove Keyboard”. This window lets you control the glove position and selected gesture. Movement control of the glove uses the mouse and is the same as that of the wand. The mouse buttons are used to select gestures. The mapping of the gesture numbers to actual hand positions is controlled by the “training file” for the sim glove. The default training file is $VJ_BASE_DIR/share/vrjuggler/data/gesture/simpleSimGestures.dat.

Using a Simulated Analog Device

If you include the sim.analog.wandmixin.jconf file, your application will also have access to a set of four analog devices (devices with a value in a range from 0.0 to 1.0). The analog devices are also controlled using the “Wand Keyboard” window which means that their configuration file requires the wand configuration file.

Note

A separate file, sim.analog.mixin.jconf, is provided for analog input from a separate simulator window.

The key presses used for controlling the analog devices are listed in Table 5.4, “Analog Device Simulator Keys”.

Table 5.4. Analog Device Simulator Keys

Analog Device ActionKey Press
VJAnalog0 increaseQ
VJAnalog0 decreaseA
VJAnalog1 increaseW
VJAnalog1 decreaseS
VJAnalog2 increaseE
VJAnalog2 decreaseD
VJAnalog3 increaseR
VJAnalog3 decreaseF