jCAE - VTK
Introduction
The jCAE project has started a migration process from Java3D to VTK. The main reason why we are giving up java3d is the lack of picking features. The viewer3d module will be replaced by a vtk-util module.
Building VTK
Getting source
Kitware doesn't provide binary distributions with Java binding enabled so you have to build VTK by yourself. The current version of vtk-util require at least VTK 5.2 and is known to work with VTK 5.3 (current CVS HEAD). Both are unreleased CVS versions. See http://www.vtk.org.
Dependencies
Here are the requirements to build VTK with Java binding:
- patch. You have it in your Linux distro. There are also Windows binaries.
- cmake
- GNU make and gcc [Linux], or Visual Studio Express [Windows], or any other set of compilation tool supported by cmake.
- OpenGL header and developer libraries
- The Sun Java Development Kit
On Debian/Ubuntu system just do:
apt-get install patch make cmake libgl1-mesa-dev sun-java6-jdk
Patching
Developing jCAE we fixed several problems in VTK and made some patches. Writting thoses lines, those patches are not yet integrated in the VTK CVS repository. You may find them here: https://jcae.svn.sourceforge.net/svnroot/jcae/trunk/vtk-util/patch. The patching commands will look like this:
cd /a/foo/path/VTK patch -p0 < /tmp/underscore.patch patch -p0 < /tmp/displayList.patch patch -p0 < /tmp/translucent.patch patch -p0 < /tmp/offset.patch
The patch directories also include an apply.sh script which will automatically apply all patches if you have quilt installed. Just call it from the VTK directory.
Configuring and building
mkdir /a/bar/path/build-vtk cd /a/bar/path/build-vtk cmake /a/foo/path/VTK
This will create a default configuration file name CMakeCache.txt. To build the Java binding you have to modify it. Here is an example for Debian like distribution:
VTK_WRAP_JAVA:BOOL=ON //Path to a program. JAVA_ARCHIVE:FILEPATH=/usr/bin/jar //Path to a file. JAVA_AWT_INCLUDE_PATH:PATH=/usr/lib/jvm/java-6-sun/include/ //Path to a library. JAVA_AWT_LIBRARY:FILEPATH=/usr/lib/jvm/java-6-sun/jre/lib/i386/libjawt.so //Path to a program. JAVA_COMPILE:FILEPATH=/usr/bin/javac //Path to a file. JAVA_INCLUDE_PATH:PATH=/usr/lib/jvm/java-6-sun/include/ //Path to a file. JAVA_INCLUDE_PATH2:PATH=/usr/lib/jvm/java-6-sun/include/linux //Path to a program. JAVA_RUNTIME:FILEPATH=/usr/bin/java
Then rerun cmake ../VTK to take the change into account. Finally run make.
The building process on Windows is similar except that the CMakeCache.txt edition can be done through a GUI and that you will probably use Visual Studio instead of GNU Make/GCC.
Other documentation
For more documentation see the VTK wiki.

