Visualization Toolkit (VTK) Installation and usage
Main Page -> Documentation -> Visualization Toolkit (VTK) Installation and usage
Installation
Source code
The Gate github repository can be cloned like that
https://github.com/Kitware/VTK
This will bring you to the master branch, tags can be checked out like this
git checkout v8.0.1
Compilation
Make a build directory and execute in this directory `cmake <SOURCEDIR>`. Some interesting switches can be added with `-DSWITCH`
- `CMAKE_INSTALL_PREFIX`
- `VTK_WRAP_TCL` wrapper code for TCL
- `VTK_WRAP_PYTHON` wrapper code for Python
- `VTK_FORBID_DOWNLOADS` skip downloading of test data
- `VTK_RENDERING_BACKEND` default OpenGL2
- `BUILD_EXAMPLES` set to `ON` if examples should be built
Example session
mkdir build cd build cmake -DCMAKE_INSTALL_PREFIX=../install -DVTK_WRAP_PYTHON=ON -DVTK_FORBID_DOWNLOADS=ON make install
Running
Make sure that the `bin` and `lib` directories of the installation are part of `PATH` and `LD_LIBRARY_PATH` respectively, e.g.
export PATH=/the_installation_directory/bin:$PATH export LD_LIBRARY_PATH=/the_installation_directory/lib:$LD_LIBRARY_PATH
TCL bindings
Start `vtk` and get the interactive prompt. Or run one script of the examples directly, e.g.
vtk Examples/Tutorial/Step1/Tcl/Cone.tcl
Python bindings
Set `PYTHONPATH` to enable Python to find the available modules
PYTHONPATH=$VTK_install/lib/pythonx.x/site-packages
Run a script directly
python Examples/Tutorial/Step1/Python/Cone.py
Interactive Python
Run either `python` or `ipython` without arguments to come to the prompt. `ipython` can be recommended for interactive sessions.