Starting with the 6.2.0 release, VTK now provides support for mobile architectures, specifically iOS and Android. The new OpenGL2 rendering backend supports both OpenGL ES 2.0 and 3.0. VTK’s build system has also been simplified for cross-compiling to mobile architectures.
With these changes, VES will soon be deprecated in favor of VTK for all new mobile development. As this support is currently considered beta quality, we encourage contributors to use, extend, and file bugs against VTK for these architectures.
The remainder of this post is a guide for building VTK for mobile devices:
iOS
First ensure that you have the latest Xcode and XCode developer tools installed.
To build the VTK framework for iOS development, configure CMake with VTK_IOS_BUILD=ON. CMake will then present a limited set of options, which will we shortly review. Be sure to generate only Unix Makefiles or Ninja build files, as Xcode will not work for this special build. Then use CMake as usual to produce project build files.
The project files generated by CMake will perform three builds. The first is done to generate VTK’s compile tools which are needed for cross compilation. The second build compiles all supported VTK libraries for the specified device architectures. The last build compiles the same libraries for the specified simulator architectures.
Once the three builds have been completed, all built libraries are statically combined into vtk.lib using libtool. This, along with the VTK header files, constitutes vtk.framework which can be used directly in iOS projects.
For a starting point, there are several examples in the Examples/iOS directory.
The CMake options relevant to most users here are:
CMAKE_FRAMEWORK_INSTALL_PREFIX is the directory in which vtk.framework will be installed. This path defaults to /usr/local/frameworks, which is where the examples bundled with VTK will look for the framework.
IOS_DEVICE_ARCHITECTURES is the list of device architectures to build. Check the current Xcode documentation to choose the correct architectures for your supported devices.
IOS_SIMULATOR_ARCHITECTURES is the list of simulator architectures to build. Typically this is simply i386 or x86_64, i.e., the architecture of your development and/or testing machines.
OPENGL_ES_VERSION should be either 2.0 or 3.0.
Android
Update: Please use VTK v6.2.0.rc1 or later as v6.2.0 has a bug that will prevent a successful build.
First ensure that you have installed the latest Android NDK (Native Development Kit). As of writing, VTK supports NDK versions 5 through 10d (December 2014).
Configure CMake with VTK_ANDROID_BUILD=ON, confirm or change the presented options, then build. Currently only Makefiles and Ninja build files are supported. As with the iOS build process, VTK will be built more than once. For Android only two passes are required, once for the compile tools and a second time to cross-compile to the chosen Android architecture.
The built static libraries can then be used in your Android project. Unfortunately as of this writing, there are no examples for Android. We encourage all developers to share and contribute examples when possible.
For Android, the relevant CMake options are:
ANDROID_NDK specifies the path to the Android NDK. Typically this is /opt/android-ndk on Unix-like systems.
ANDROID_ARCH_NAME specifies the target Android architecture for cross compilation.
ANDROID_NATIVE_API_LEVEL – The API level to support. For example, Android 5.0 ‘Lollipop’ is API level 21.
OPENGL_ES_VERSION should be 2.0 or 3.0.
Pingback: Arron Guo
Pingback: Tim Thirion
Pingback: Lonni Besançon
Pingback: Tim Thirion
Pingback: Lonni Besançon
Pingback: William Du Roy
Pingback: Tim Thirion
Pingback: Lonni Besançon
Pingback: Tim Thirion
Pingback: Lonni Besançon
Pingback: Tim Thirion
Pingback: Lonni Besançon
Pingback: Tim Thirion
Pingback: William Du Roy
Pingback: Tim Thirion
Pingback: shengfei
Pingback: William Du Roy
Pingback: Tim Thirion
Pingback: William Du Roy
Pingback: Tim Thirion
Pingback: Yassmin Abdallah
Pingback: shengfei
Pingback: Tim Thirion
Pingback: Yassmin Abdallah
Pingback: Tim Thirion
Pingback: Yassmin Abdallah
Pingback: Yassmin Abdallah
Pingback: Tim Thirion
Pingback: Yassmin Abdallah
Pingback: Tim Thirion
Pingback: occularis
Pingback: Roberto Garrido Martín
Pingback: Tim Thirion
Pingback: Andrei
Pingback: shengfei
Pingback: Tim Thirion
Pingback: leon
Pingback: shengfei
Pingback: Tim Thirion
Pingback: shengfei
Pingback: Tim Thirion
Pingback: shengfei
Pingback: Tim Thirion
Pingback: shengfei
Pingback: shengfei
Pingback: shengfei