1#! /bin/bash
2
3scriptdir=`dirname $0`
4
5function print_usage() {
6    echo "Usage: $0 [-libdir pre-lib-dir] jogl-build-dir ..."
7}
8
9if [ "$1" = "-libdir" ] ; then
10    shift
11    if [ -z "$1" ] ; then
12        echo libdir argument missing
13        print_usage
14        exit
15    fi
16    PRELIB=$1
17    shift
18    LD_LIBRARY_PATH=$PRELIB:$LD_LIBRARY_PATH
19    export LD_LIBRARY_PATH
20fi
21
22if [ -z "$1" ] ; then
23    echo JOGL BUILD DIR missing
24    print_usage
25    exit
26fi
27
28. $scriptdir/setenv-jogl.sh $1
29shift
30
31MOSX=0
32uname -a | grep -i Darwin && MOSX=1
33
34if [ $MOSX -eq 1 ] ; then
35    X_ARGS="-XstartOnFirstThread"
36fi
37
38# D_ARGS="-Dgluegen.debug.ProcAddressHelper=true -Dgluegen.debug.NativeLibrary=true -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all"
39# D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all -Djogl.debug.GLSLState"
40# D_ARGS="-Dnativewindow.debug.X11Util=true -Djogl.debug.GLDrawableFactory=true"
41# D_ARGS="-Dnativewindow.debug.X11Util=true -Dnewt.debug.Display=true"
42# D_ARGS="-Dnewt.debug=all"
43# D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all"
44
45java $X_ARGS -Djava.awt.headless=true $D_ARGS com.jogamp.newt.util.MainThread $* 2>&1 | tee java-run-newt.log
46