Preparation

Getting ARToolKit

The recommended version of ARToolKit for use with osgART is 2.72.1. This is available either using Subversion to check out the repository from the following address:

http://artoolkit.svn.sourceforge.net/svnroot/artoolkit/branches/hartmut-pre-2_8/artoolkit

or it can be downloaded directly as a TAR archive.

Check out or download ARToolKit to a directory of your choosing, such as shown here:

build_artoolkit_dir.jpg

CMake

The recommended approach to building ARToolKit is to use CMake. CMake is tool that creates and configures the necessary project files for your particular system and development environment. Ensure you have at least CMake version 2.6.2 installed.

Compiler on Windows

ARToolKit can be build with virtually any ANSI C compliant compiler. However, due to the fact that ARToolKit relies on video capture you need DirectShow on Windows which is the most versatile and also the default video capture backend supported. There are no known out of the box solutions for free compilers such as MinGW or Cygwin. Hence, you need Visual Studio 2003 or later for successfully compiling ARToolKit on Windows. Furthermore, starting with Visual Studio 2005 you need the respective Windows SDK. A word of caution here, we have not yet evaluated the case of Visual Studio 2008 and the Windows 7 SDK (the latest SDK available from Microsoft) which supposedly ships with fixed headers.

Building on Windows

All known Windows SDKs except for the SDK integrated with Visual Studio 2003 you need to patch some of the headers that ship with the SDK. Instructions on how to do this are here.

Run CMake and enter the ARToolKit directory into box labelled “Where is the source code”. You can either type in the directory, use the Browse button, or drag and drop the CMakeLists.txt file from the ARToolKit directory onto CMake. The box labelled “Where to build the binaries” will automatically fill to match the same directory, however, it is recommended that you append “\build” here, so that the project files and build output will not be created within the source tree.

<File:build_artoolkit_cmake_paths.jpg>

Press “Configure” and a dialog box will appear where you can select which build system you wish to use. For example, if you are using Microsoft Visual Studio 2008, you would make the following selection:

<File:build_artoolkit_cmake_generator.jpg>

If you are alerted that the build directory does not exist, allow CMake to create it.

Cmake will process for a short time, and then present a set of values.

build_artoolkit_cmake_configure1.jpg

You can edit these values to change the configuration.

  • CMAKE_INSTALL_PREFIX: Set this to the directory where you would like the build version of ARToolKit to be placed

Press “Configure” again to confirm the values (the red lines should turn grey), and then press “OK” to generate the project files. After the project files have been generated, the CMake window will close.

Open the “Build” directory and run the “ARToolKit.sln” file to load it in Visual Studio. Select the configuration type (e.g. Debug, Release) and build the “INSTALL” target.

You may see warnings related to deprecated string functions (e.g. sprintf). These can be ignored.

If you get an error that dxtrans.h cannot be found, then you have not yet patched the DirectShow headers as instructed earlier in this section.

All projects in the solution should build successfully. The INSTALL target will additionally copy the built binary files and supporting data files to the directory set in CMake (CMAKE_INSTALL_PREFIX).

Testing

Open the directory where the ARToolKit binaries have been copied (CMAKE_INSTALL_PREFIX). From this directory you can run the ARToolKit examples to verify a successful build.

Print out the pattHiro.pdf file from the “share\artoolkit-2.72\patterns” directory. Assuming you have a working webcam, run SimpleTest.exe, and click through the webcam configuration dialog that appears. Point your webcam at the printed pattern, and you should see a blue cube sitting on the marker.

build_artoolkit_simpletest.jpg

Category:Preamble