VTK Usage Notes

Environment Variables

The environment variables necessary to use VTK are automatically loaded into your BASH shell. These variables are appended to CLASSPATH and LD_LIBRARY_PATH. VTK-5.2.1 is currently installed.

Writing a VTK Application

VTK programs can be written in C++, Java, Python, or Tcl. All language bindings except Java are available on the Linux cluster; please contact IVC Staff if you wish to use Java bindings on Linux. 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 excerpts of code provide examples on how to implement stereo mode in your VTK applications. Modify it as necessary for other languages and to suit your needs.


#setup your renderer and window
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()

#Stereo stuff here
#IVC's system of stereoscopic vision. VTK default is red/blue.

renWin.StereoRenderOn() #activates stereo by default. Press '3' to toggle stereo
#ren.GetActiveCamera().SetEyeAngle(number) #may need to use to alter eye angle



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

// Enable stereo capabilities in the Render Window

// 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();

Saving Snapshots

Additional Help

[back to documentation]