VTK Usage Notes

Environment Variables

The environment variables necessary to use VTK-4.2 are automatically loaded into your BASH shell. On the SGI, these variables are appended to CLASSPATH and LD_LIBRARYN32_PATH; on the Linux cluster, CLASSPATH and LD_LIBRARY_PATH. VTK-4.4 is installed on the SGI. You will need to manually change your environment variables to use version 4.4.

Writing a VTK Application

VTK programs can be written in C++, Java, Python, or Tcl. All language bindings are available on the Linux cluster; only Java bindings are installed on the SGI. For simple example code to help get you started with VTK, see Example VTK Code. There are many other examples included in the source distribution of VTK, available at www.vtk.org.

Implementing Stereo Mode

The following excerpt of Java code provides an example on how to implement stereo mode in your VTK applications. Modify it as necessary for other languages and to suit your needs.

// Create render window to show up on screen.
// A vtkRenderer (ren1) should be created prior to this code block
vtkRenderWindow renWin = new vtkRenderWindow();
renWin.AddRenderer(ren1);

// Enable stereo capabilities in the Render Window
renWin.SetStereoTypeToCrystalEyes();
renWin.StereoCapableWindowOn();

// Create a vtkRenderWindowInteractor to provide mouse/keyboard interaction
// Keypress '3' toggles stereo mode on/off
// Mouse buttons translate, rotate, and zoom
// For other interactions, see VTK documentation
vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();
iren.SetRenderWindow(renWin);
iren.Initialize();
renWin.Render();
iren.Start();

Saving Snapshots

Additional Help

[back to documentation]