#!/bin/sh

# PGRFlyCapture and OpenCV, both compiled with Intel's Compiler,
# do not play nice with each other...
KMP_DUPLICATE_LIB_OK=TRUE
export $KMP_DUPLICATE_LIB_OK

# Required option for full-screen support under Mac OS X
OPTIONS=-Dapple.awt.fullscreencapturealldisplays=false

# Not all video drivers support OpenGL well, so we let it disabled
# by default, but you can try to enable it here to get lower latency.
#OPTIONS="-Dapple.awt.fullscreencapturealldisplays=false -Dsun.java2d.opengl=True"

# Work around stability issues on some systems, but this causes memory leaks...
OPTIONS="$OPTIONS -Dorg.bytedeco.javacpp.nopointergc=true"

java -d64 -server -version
if [ $? -eq 0 ]
then
java -d64 -server $OPTIONS -jar "`dirname "$0"`/modules/procamtracker.jar" --laf javax.swing.plaf.metal.MetalLookAndFeel "$@"
else
echo "WARNING: 64-bit server JVM not available. Executing with default JVM..."
java $OPTIONS -jar "`dirname "$0"`/modules/procamtracker.jar" --laf javax.swing.plaf.metal.MetalLookAndFeel "$@"
fi
