Updated 19 October 2007: Modified for Ubuntu 7.10, FreeImage package now included. New revisions of H3D with new src/include layout. Separated my config patch from the ftgl include fix patch.
Updated 9 October 2007: Added script for PHANToM0.ini
Created 28 September 2007.

H3D GNU/Linux Trunk how-to

This guide is made especially for Ubuntu users, and tested to be working starting with a fresh installation of Ubuntu 7.04 (standard 32 bit version). 64 bit version has reported problems. My patches below are only to configure the API to compile with Open Haptics support and not much more. If you need CG etc, please read the manual and change the makefiles and .h-files accordingly. You will also have to install Open Haptics which unfortunately is not available public online, but on request by Sensable.

Tested on revision: (H3DAPI: 876) (HAPI: 232) (H3DUtil: 42)

/Jonas Forsslund, jofo02 (at) kth.se
Please mail any feedback to this guide

Dependent libraries

Install dependent libraries

sudo apt-get update
sudo apt-get install gcc g++ libxerces27 libxerces27-dev ftgl-dev libopenal0a      \
 libalut0 libalut-dev libopenal-dev libglew-dev libglut libglut3-dev libcurl3-dev  \
 libaudiofile-dev libfontconfig1-dev libfontconfig1 libmotif3 subversion           \
 libvorbis-dev python-dev python-all-dev libfreeimage-dev alien

Download Freeglut 2.4.0 http://freeglut.sourceforge.net/index.php#download and remember the configure flags. If you use the package freeglut3-dev H3D will work but with no exception handling when closing windows and so on.

wget http://ovh.dl.sourceforge.net/sourceforge/freeglut/freeglut-2.4.0.tar.gz
tar -xzvf freeglut-2.4.0.tar.gz
cd freeglut-2.4.0
./configure CFLAGS="-fexceptions" CXXFLAGS="-fexceptions"
make
sudo make install

Receive OpenHaptics_AE_LinuxV2.0.zip, then install the rpm's through Alien:

cd ~
unzip OpenHaptics_AE_LinuxV2.0.zip
cd PHANTOM\ Device\ Drivers/
sudo alien -k phantomdevicedrivers-4.3-1.i686.rpm 
sudo dpkg -i phantomdevicedrivers_4.2-2_i386.deb 
cd ..
cd OpenHaptics-AE\ 2.0/
sudo alien -k openhaptics-ae-2.0-1.i686.rpm 
sudo dpkg -i openhaptics-ae_2.0-1_i386.deb 

Check out H3D from trunk and install

Create a directory somewhere

mkdir ~/H3DTrunkGNULinux
cd ~/H3DTrunkGNULinux

Now, check out from subversion (revision of 19th October 2007):

svn checkout --revision 876 https://www.h3dapi.org:8090/H3DAPI/trunk/H3DAPI 
svn checkout --revision 232 https://www.h3dapi.org:8090/HAPI/trunk/ HAPI
svn checkout --revision 42 https://www.h3dapi.org:8090/H3DUtil/trunk/H3DUtil

Apply patches (license: public domain) which configures H3D for this standard installation: jonasH3DAPI.dff jonasHAPI.diff and fixes the ftgl include problem H3DAPI_ftgl_includes.diff

wget http://www.nada.kth.se/~jofo02/H3DAPI_ftgl_includes.diff
wget http://www.nada.kth.se/~jofo02/jonasH3DAPI.diff
wget http://www.nada.kth.se/~jofo02/jonasHAPI.diff
patch -p0 < H3DAPI_ftgl_includes.diff 
patch -p0 < jonasH3DAPI.diff 
patch -p0 < jonasHAPI.diff 

Now make and make install! (the MAX_FILES error from make update script can be considered a warning, it works anyway)

cd H3DUtil/build/linux/
make update
make
sudo make install

cd ../../../HAPI/build/linux
make update
make
sudo make install

cd ../../../H3DAPI/build/linux
make update
make
sudo make install

Verify

cd ~/H3DTrunkGNULinux/H3DAPI/examples/SuperShape/
H3DLoad SuperShape.x3d 

You might have to set the right environment variables first

export H3D_ROOT=~/H3DTrunkGNULinux/H3DAPI
export PYTHONPATH=~/H3DTrunkGNULinux/H3DAPI/lib/

Configure Phantom Haptic Device

If you have a PHANTOM Omni device:

sudo modprobe raw1394
sudo chmod o+rw /dev/raw1394
PHANToMConfiguration 
PHANToMTest

PHANToMConfiguration can be bit frustrating to use, but you only have to set it to "Default PHANToM", model "Omni" and hit Ok. You might have to change back and forward to be able to do this tough.

Then, if you need to, exchange all "," with "." in floating point numbers in /etc/SensAble/PHANToMDeviceDrivers/PHANToM0.ini. I made a script which does this: phantomfix.py

wget http://www.nada.kth.se/~jofo02/phantomfix.py
sudo python phantomfix.py

Ubuntu 7.04

If you are using 7.04 instead, you will need to download and install Freeimage before you compile H3D. Download Freeimage http://freeimage.sourceforge.net/download.html

unzip FreeImage393.zip
cd FreeImage 
make
sudo make install


Good Luck!