oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button

3-D Data Visualization on Mac OS X
Pages: 1, 2, 3, 4

Simple Sanity Check for VTK

Now that the VTK software installation is completed you may want some sort of instant gratification for your hard work. Try running the TimeRenderer and TimeRender2 examples in the bin directory.

cd /Develop/osxBin/bin

Both the TimeRendered and TimeRenderer2 examples will execute on their own for a few seconds and then abort. Don't panic when you see the abort message. This is exactly how the example programs should behave. You should see,

Wall Time = 8.35666
FrameRate =14.3598
TriRate = 1.4879e+06

For a real quick-and-dirty test run the Mace test in the following manner:

./Mace -I &

This simple test will generate the image in Figure 2.

Figure 2
Figure 2. Sample output of the Mace test program.

For a more interesting test, edit the Mace.cxx source code. First go over to the source code directory for Mace and make a backup of the source code. Then edit the source code for Mace.cxx.

cd /Develop/VTK/Graphics/testing/Cxx
cp Mace.cxx Mace.cxx.bak
emacs Mace.cxx

The emacs editor is provided for example only. Use whatever text editor you're accustomed to. Now make the following changes to the Mace.cxx source code:

if (retVal == vtRegressionTester::DO_INTERACTOR)




Remove the conditional statement, so the code reads as follows:


You will then need to recompile the source. Be sure you change directories back over to the /Develop/osxBin/Graphics/testing/Cxx. We want to leave the original VTK directories in tact.

cd /Develop/osxBin/Graphics/testing/Cxx
sudo make

This will take a minute or two (on a Macintosh G4 450). Then go back to the VTK/bin directory and execute the Mace program.

cd /Develop/osxBin/bin

Click your mouse inside the window to interact with the Mace program. Typing the letter 'q' exits the application. If you're playing around with the Mace application you have successfully installed the VTK software.

Setting Up VTK for Tcl

Now that you've had some fun with VTK, let's get back to business and finish setting up VTK to run with Tcl. Before I forget, let's set the environment variable for Tcl to find the VTK packages. You'll need to determine which Unix shell you are using. If you're not sure, use the following command from your terminal prompt:

echo $SHELL

I am using the tcsh - C shell. So I would edit my tcsh resource file to include this environment variable:

emacs ~/.tcshrc
setenv TCLLIBPATH "/Develop/osxBin/Wrapping/Tcl"
setenv VTK_ROOT_DATA "/Develop/VTKDATA"

Close and save the file (emacs CTRL X-C) and source the file to update the changes made. The environment variable VTK_ROOT_DATA tells VTK where to find the image examples we'll be using.

source ~/.tcshrc

Getting the Tcl/Tk Frameworks Files for Mac OS X

A special disk image file is available from the atamai Web site. Download the Tcl/Tk Frameworks. This image is required for the Carbon Mac OS X build.

Editing the /VTK/CmakeCache.txt File

We will need to edit the /VTK/CmakeCache.txt file once more. First of all, we need to turn on the Tcl wrapping functionality. Edit the /Develop/osxBin/CMakeCache.txt and search for the string "VTK_WRAP_TCL". Change the default setting from:




Also insert the following definitions into the /Develop/osxBin/CMakeCache.txt file.

// set path to the tcl 0header files

// set path to Tcl libraries

// set to the tclsh file.
MacOS/Wish\ Shell // set the path to the tk.h header file TK_INCLUDE_PATH:PATH=/Library/Frameworks/Tk.framework/Headers // set the path to the Tk libraries TK_LIBRARY:FILEPATH=-framework Tk

Once you have completed these changes, you need to run CMake and then make again.

cd /Develop/osxBin cmake ../VTK make

Pages: 1, 2, 3, 4

Next Pagearrow