VTK is used by academicians for teaching and research; by government research institutions such as Los Alamos National Lab in the US or CINECA in Italy; and by many commercial firms who use VTK to build or extend products. VTK has grown to a world-wide user base in the commercial, academic and research communities since its initial release in 1994.
This README is written for VTK version 4.2 and greater. For more information, additional resources and the FAQ see the web page at VTK.
OrganizationThe VTK 4.2 source code repository is organized into four major sections.
The ideal way to learn about the software is from two books, The Visualization Toolkit An Object-Oriented Approach To 3D Graphics and The Visualization Toolkit User's Guide, both published by Kitware. The latest on-line Doxygen man pages are also available here.
The following instructions only apply to UNIX systems. First we will give you the quick and dirty way to build VTK. Begin by telling CMake what C and C++ compilers you will be using. This can avoid many build problems. On most systems you can pass this information to CMake in the following way:
env CXX=/your/C++/compiler CC=/your/c/compiler cmake
If you will be using C++ as your development language (no Tcl/Tk, Python or Java support):
1) untar the src files into directory vtk-src-unix 2) untar the data files into directory VTKData 3) cd vtk-src-unix 4) cmake -i (run cmake in wizard mode, where you have to answer questions about the build) or ccmake (run the terminal based interface to cmake where you interactively change build options) 5) change build options if necessary 6) makeNote that this will create the binaries (i.e., object code, libraries, and executables) in the same directory as the source code. You can also build VTK out of source in a separate directory (this is particularly convenient when building VTK on multiple architectures). Instead of running CMake from the vtk-src-unix directory, create a new directory with enough disk space (not in the vtk-src-unix tree) such as vtk-solaris. cd into this directory and then run CMake similar to the following example:
ls /home/foo vtk-src-unix VTKData vtk-solaris cd vtk-solaris ccmake /home/foo/vtk-src-unix or cmake -i /home/foo/vtk-src-unixThis will create makefiles in the vtk-solaris directory. Then you can run make in vtk-solaris to compile VTK. Repeat this process for each architecture you wish to build.
Note: For your convenience, we have installed VTK on the Unix system in CIS environment. The root directory is /usr/class/graphics/VTK-4.2. The source code and the compilation files (i.e., object code, libraries and executables) are in /usr/class/graphics/VTK-4.2/vtk-src-unix and /usr/class/graphics/VTK-4.2/vtk-solaris respectively. Please note that we assume you will be using C++ as your development language so we only build VTK source code under C++ compiler. If you wanna to use the header files and libraries in VTK, they are located at /usr/class/graphics/VTK-4.2/include/vtk and /usr/class/graphics/VTK-4.2/lib/vtk respectively.
If you want to build the Tcl-based VTK interpreter then you will need to have Tcl and Tk (8.2 or newer). Look to Tcl Developer Xchange for information about getting Tcl and Tk. To turn on Tcl wrapping, set VTK_WRAP_TCL to ON during the configuration process (as a post-build step, you might want to check the /usr/class/graphics/VTK-4.2/vtk-src-unix/Wrapping/Tcl/README file). You will then have to set the values for Tcl/Tk include directories and libraries.
If you want to use VTK from Python you will need to have Python installed. To turn on Python wrapping, set VTK_WRAP_PYTHON to ON during the configuration process and then set the values for the Python related directories and libraries. If you want to use Tkinter with VTK-Python then you should also turn on Tcl wrapping by setting VTK_WRAP_TCL to ON. Make sure that the Tcl/Tk libraries that you set correspond to the same version used by Tkinter. Note that the VTK-Python modules are not installed by default via make install. The /usr/class/graphics/VTK-4.2/vtk-src-unix/Wrapping/Python/README.txt file documents the installation procedure and the VTK-Python modules.
The build process for Cygwin is almost exactly the same as the UNIX build process if you will be using C++ as your development language (no Tcl/Tk, Python or Java support):
1) untar the src files 2) untar the data files 3) cd vtk-src-unix 4) cmake -i (run cmake in wizard mode, where you have to answer questions about the build) or ccmake (run the terminal based interface to cmake where you interactively change build options) 5) change build options if necessary 6) make
The PC build process uses the CMake GUI CMakeSetup. Then you use the compiler make utility to compile as follows:
1) Install the VTK 4.2 distribution by unzipping into the appropriate directory. 2) Execute CMakeSetup. This will pop-up a little GUI that allows you to tailor the build. It then starts building .dsw and .dsp files for Microsoft, or makefiles for Borland. You'll have to tell CMakeSetup where you've placed your VTK source code, and where to build the object code and dll's (we'll call it "vtkbin"). 3) When CMakeSetup completes, start up msdev and load VTK.dsw. Select ALL_BUILD project, and build it.We recommend a 300MByte minimum swap size or you'll have trouble during the link phase.
1) Download the data from /usr/class/graphics/VTK-4.2/vtk-src-unix/VTKData 2) Checkout the data from CVS using the folling commands: cvs -d :pserver:firstname.lastname@example.org:/vtk/cvsroot login (respond with password vtk) cvs -d :pserver:email@example.com:/vtk/cvsroot checkout VTKData
vtk mace.tclNote that most Tcl scripts allow you to type "u" in the render window to obtain an interpreter. You can use the interpreter to modify the application at run-time.
If you have enabled Python Wrapping you should read the instructions located in the /usr/class/graphics/VTK-4.2/vtk-src-unix/Wrapping/Python/README.txt file.
1) Create a new directory called VTK/Local. 2) Create a file called LocalUserOptions.cmake in VTK/. In that file,add the command SUBDIRS(Local). This will add the Local directory to the build. 3) Create the .cxx and .h file for the new class in VTK/Local. Make sure that you use VTK conventions to insure that the wrapping occurs correctly. Complex code may break the wrapper parser; use //BTX and //ETX around the code to fix this. 4) Create a CMakeLists.txt in VTK/Local. You can model it after a CMakeList.txt file found in another directory (like VTK/IO/CMakeLists.txt). 5) Rerun ccmake (Unix) or CMakeSetup.exe (Windows). 6) Then make/gmake (Unix) or msdev (Windows).
If you run into problems, you may either contact me or post your questions to VTK mailing list. Click here to join the list.
Maintained by Chaoli Wang (firstname.lastname@example.org)