# Welcome To The Visualization Toolkit

- Copyright Notice
- Introduction
- Documentation
- Installation
  - Unix Installation
  - PC Installation
- Execution
- Common Problems
- Adding A New Class

# Copyright Notice

    Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen
    All rights reserved.

    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are met:

     * Redistributions of source code must retain the above copyright notice,
       this list of conditions and the following disclaimer.

     * Redistributions in binary form must reproduce the above copyright notice,
       this list of conditions and the following disclaimer in the documentation
       and/or other materials provided with the distribution.

     * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
       of any contributors may be used to endorse or promote products derived
       from this software without specific prior written permission.

     * Modified source versions must be plainly marked as such, and must not be
       misrepresented as being the original software.

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
    ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Introduction

The origin of VTK is with the textbook "The Visualization Toolkit, an Object-Oriented Approach to 3D Graphics" published by Prentice Hall (ISBN 013199837-4). VTK has grown (since its initial release in 1994) to a world-wide user base in the commercial, academic, and research communities.

This is VTK version 3.2. For more information and a FAQ see our web page at http://www.kitware.com

# Documentation

The ideal way to learn about the software is from the book it is designed to support. You should be able to get the book from any local bookstore or from our web page. The web page also contains some html reference pages for the objects in VTK as well as a FAQ.

      The Visualization Toolkit, An Object-Oriented Approach to 3D Graphics
      by Will Schroeder, Ken Martin and Bill Lorensen.
      Prentice Hall, Second Edition.
      http://www.kitware.com/book.htm

You can also order the VTK User's Guide from Kitware,Inc. See the web page http://www.kitware.com/vtkUsersGuide.htm

# Installation

The Visualization Toolkit can be built on both Unix and PC (Windows 95/98/NT/2000) systems.

### Unix Installation

The following instructions only apply to UNIX systems. The windows source distribution will be released in a different file.

First we will give you the quick and dirty way to build VTK. If you have OpenGL do the following:

If you will be using C++ as your development language:

      1) untar the src files
      2) untar the data files
      3) cd vtk
      4) ./configure
      5) read and edit user.make
      6) make

If you will be using tcl in addition to C++:

      1) untar the src files
      2) untar the data files
      3) cd vtk
      4) obtain and build Tcl/Tk if you don't already have it
      5) ./configure --with-tcl
      6) read and edit user.make
      7) make

It is a very good idea to tell configure what C and C++ compilers you will be using. This can avoid many build problems. On most systems you can pass this information to configure in the following way:

    env CXX=/your/C++/compiler CC=/your/c/compiler ./configure

otherwise you must set CXX and CC in your environment and then run configure.

This release also has Java and Python support. Use --with-java and/or --with-python to generate the Java and Python language bindings.

a If you do not have OpenGL, you will need to get and compile Mesa, a wonderful free version of OpenGL. You will need to add --with-mesa to your configure line. If you want to try building shared libraries you can use the --with-shared option also.

Now here is the slightly more detailed description of the build process.

This software uses scripts generated by GNU autoconfigure to build itself. There are a couple of options in building the software that you need to decide on. First you need to decide if you are going to use the Mesa rendering library developed by Brian Paul. This is a software renderer that VTK can use on Xwindows based workstations. If your workstation doesn't support OpenGL then you will need Mesa because you have no other choice :-) If you want to build the VTK interpreter then you will need to have Tcl8.2.3 and Tk8.2.3.

Look to http://www.scriptics.com/ for information about getting Tcl and Tk. To obtain a copy of Mesa, written by Brian Paul, you can visit http://www.ssec.wisc.edu/~brianp/Mesa.html.

To build VTK in the distribution directory just type ./configure You can specify --with-tcl and/or --with-mesa on the command line if you would like to use those packages as well. Building VTK for multiple architectures will be discussed later.

To build the VTK library and the tcl bindings and use mesa you would specify

    ./configure --with-tcl --with-mesa

The command:

    ./configure --help

gives some brief help for the command line arguments. If you are using gmake then you might want to consider the --srcdir option.

The next step is to modify the user.make file. If you are using Tcl/Tk you must specify the full path to find the include files and libraries. If you are using Mesa you must do the same. You might also want to specify the compiler flags. We recommend compiling without debug information and with optimizations. The debug information can quadruple the executable size. If you are going to be working with the C++ library you might want to look into using shared libraries. (Use the configure option --with-shared.)

Once this is done you can type make (or gmake if you have it) and it should compile :-)

If you are planning to build VTK for multiple architectures then you can either make a copy of the entire VTK tree for each architecture and then follow the instructions above. Or if you have gmake, you can have one copy of the VTK tree and compile it in a different manner. Instead of running configure from the VTK directory, create a new directory where you have some free disk space (not in the VTK tree), a possible name would be vtk-solaris. cd into this directory and then run configure similar to the following example:

    ls /home/joe_user
        vtk vtk-solaris vtk-sgi

    cd vtk-solaris
    /home/joe_user/vtk/configure --with-tcl

This will create makefiles in the vtk-solaris directory. Then you can run gmake in vtk-solaris to compile VTK. Repeate this process for each architecture you wish to build.

### PC Installation

The PC build process requires running a program to build dependencies and makefiles. Then you use the compiler make utility to compile as follows.

        1. Install vtk3.2 distribution by unzipping into the appropriate directory.

        2. Execute vtk\pcmaker\pcmaker.exe. This will pop-up a little
           GUI that allows you to tailor the build. It then starts
           building makefiles and dependencies. It will run for a couple
           minutes depending on your system. You'll have to tell pcamaker
           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 pcmaker completes, start up a MS-DOS shell window
           and change directories to vtkbin\vtkdll. Then run
           "nmake" (Microsoft compiler). This will compile for
           a LONG time. When it's done, you'll have a vtkdll.dll
           file in vtkbin\vtkdll\obj. You can then move this
           file into the appropriate system directory
           (on Win95: Windows\System; on NT: WinNT\system).

        4. If you want to use Tcl/Tk on your PC, repeat step 3 above
           except work in directory vtkbin\vtktcl to create
           vtkbin\vtktcl\vtktcl.dll. Remember to move this file into your
           system area. (You'll also have to have Tcl (e.g., Wish)
           installed.)

        5. You can then link against vtkdll.dll (C++); or run Tcl
           (wish). If you're running Tcl, make sure you start by
           dynamically loading the vtktcl libraries with the command
           "load vtktcl".

        6. Enjoy.

We recommend a 300MByte minimum swap size or you'll have trouble during the link phase.

# Execution

Many of the examples require the data found in vtk20data.part1.tar.gz through vtk20data.part4.tar.gz, plus the additional file MissingData.tar.gz. (These files can be found at ftp://public.kitware.com/pub/vtk, or in the vtkdata/ directory if this document is part of the CD-ROM distribution.) The examples that require data look for it in ../../../vtkdata. If you compiled with the --srcdir option you may need to create a symbolic link to the data directory.

To run the cc examples just type their name. To run the tcl examples, (assuming that you built the tcl stuff) type

    ../../../vtk/tcl/vtk mace.tcl

# Common Problems

- I got a "warning: no configuration information is in tcl" from configure. This is correct and is supposed to happen.
- Strange compile errors on Unix. Make sure that you specify the environment variables CXX and CC prior to running configure. (If you have already run configure, do a "make clean" to remove the cached configure information.)
- Errors on Tcl or Tk include files. Make sure that you edit user.make to point to the correct location.
- Errors on Tcl or Tk libraries. Make sure that you edit user.make to point to the correct location.
- Link errors on Windows platforms. Make sure that the swap space is at least 300 MByte.

# Adding A New Class

    1) create the .cxx and .h file for the new class in one of the existing
       directories. We recommend that you use the local/ directory.
    2) edit Makefile.in for that directory and follow the instructions in
       there. You will need to add the class in only one place.
    3) you will need to rerun configure (Unix) or pcmaker (Windows)
    4) then make/gmake (Unix) or nmake (Windows).