Visualizing with VTK

A look at a new tool for visualizations of scientific data—VTK, an object-oriented visual toolkit.
Obtaining VTK

The official source code release of VTK is available from the VTK home page at For the more daring, almost-daily beta releases are available from On the average Linux system, software required to compile and run VTK includes the following: C++, OpenGL (or Mesa), tkUnixPort.h (from the Tk source distribution), Tcl 7.4 or higher, Tk 4.0 or higher. If you plan to use the Python or Java bindings to VTK, you will need those packages as well.

Compiling VTK

The VTK source code is written entirely in C++, and as of version 2.0 with Linux 2.0.31 and either libc5 or libc6, it compiles successfully without error with Mesa 2.5 and Tcl/Tk 8.0. In the README file at the top of the distribution, the user will find all the instructions necessary to do the build. Here's what I did:

  1. Obtained and compiled Mesa (easy).

  2. Retrieved tkUnixPort.h from the Tk source distribution and placed it in the (vtk_top_dir)/unix/directory (I used Tcl/Tk 8.0).

  3. Ran ./configure --with-mesa --with-tcl --with-shared --with-tkwidget --with-patented

  4. Edited user.make to find all the necessary support files.

  5. Ran make.

  6. Ran make install (optional; run only if you have the disk space).

Many more configuration options are available and can be seen by typing ./configure --help. I had trouble with the Python and Java bindings. The build, as configured above, takes about an hour on a Pentium-Pro 200MHz machine.

Many examples are available to test the installation in the (vtk_top_dir)/[graphics|imaging|patented|contrib]/examples[Cxx|tcl|Python] directories. Most imaging examples require the vtkdata archive to also be located at the VTK home site. Graphics examples will, for the most part, run as is. For the C++ examples, compile with make and run. Tcl examples can be run by typing the following from the Tcl examples directory: ../../tcl/vtk example_file.tcl, or, if vtk has been installed, vtk example_file.tcl. Examples employing the TkRenderWidget object cause a segmentation fault when using the XFree SVGA server, but work with the S3 server. (I haven't tested others.) Fortunately, TkRenderWidget is not required for any visualization pipeline; you can't embed the render window in a Tk window. However, this problem will likely be solved by the time you read this article.

James C. Moore is a Research Scientist for Applied Research Associates in Columbus, Ohio. His interests include numerical simulation of casting processes, gardening and losing money by fixing old Mercedes. He and Kim (the real writer) have two daughters, Lorien and Kathryn. Jim doesn't do Windows. He can be reached via e-mail at


White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState