301 lines
9.8 KiB
Bash
Executable File
301 lines
9.8 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# Copyright (C)2004 Landmark Graphics Corporation
|
|
# Copyright (C)2005 Sun Microsystems, Inc.
|
|
# Copyright (C)2009-2011 D. R. Commander
|
|
#
|
|
# This library is free software and may be redistributed and/or modified under
|
|
# the terms of the wxWindows Library License, Version 3.1 or (at your option)
|
|
# any later version. The full license is in the LICENSE.txt file included
|
|
# with this distribution.
|
|
#
|
|
# This library is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# wxWindows Library License for more details.
|
|
|
|
# The interpreter to use (if this script is submitted to N1 Grid Engine):
|
|
#$ -S /bin/sh
|
|
#
|
|
# This allocates a graphics device and passes it in the VGL_DISPLAY
|
|
# environment:
|
|
#$ -l gfx=1
|
|
#
|
|
# Specify other environment variables that N1GE should pass to this script:
|
|
#$ -v DISPLAY
|
|
#$ -v SSH_CLIENT
|
|
#$ -v VGL_CLIENT
|
|
#$ -v VGL_COMPRESS
|
|
#$ -v VGL_PORT
|
|
#$ -v VGL_SSL
|
|
#$ -v VGL_GLLIB
|
|
#$ -v VGL_X11LIB
|
|
#$ -v VGL_GAMMA
|
|
#$ -v VGL_PROGRESSIVE
|
|
#$ -v VGL_NPROCS
|
|
|
|
usage()
|
|
{
|
|
echo
|
|
echo "Usage: `basename $0` [options] [--] <OpenGL app> [OpenGL app arguments]"
|
|
echo
|
|
echo "VirtualGL options (see documentation for a more comprehensive list)"
|
|
echo
|
|
echo "-c <c> : proxy = Send 3D images uncompressed using X11 Transport"
|
|
echo " [default for local X connections]"
|
|
echo " jpeg = Compress 3D images using JPEG/send using VGL Transport"
|
|
echo " [default for remote X connections]"
|
|
echo " rgb = Encode 3D images as RGB/send using VGL Transport"
|
|
echo " xv = Encode 3D images as YUV420P/send using XV Transport"
|
|
echo " yuv = Encode 3D images as YUV420P/send using the VGL Transport"
|
|
echo " and display on the client using X Video"
|
|
echo " [If an image transport plugin is being used, then <c> can be any"
|
|
echo " number >= 0 (default=0).]"
|
|
echo
|
|
echo "-nodl : If an app uses dlopen() to explicitly access libGL.so, don't"
|
|
echo " force it to open VirtualGL instead (see docs)"
|
|
echo
|
|
echo "-d <d> : <d> = the X Display to use for 3D rendering [default = :0.0]"
|
|
echo
|
|
echo "-fps <f> : Limit client/server frame rate to <f> frames/sec"
|
|
echo
|
|
echo "-gamma <g>: Set gamma correction factor to <g> (see docs)"
|
|
echo
|
|
echo "-ge : Fool application into thinking that LD_PRELOAD is unset"
|
|
echo
|
|
echo "-ms <s> : Force VirtualGL to use OpenGL multisampling with <s>"
|
|
echo " samples (<s> = 0 forces multisampling to be disabled)"
|
|
echo
|
|
echo "-np <n> : Use <n> CPUs to perform image compression [default = 1]"
|
|
echo
|
|
echo "+/-pr : Enable/disable performance profiling output [default = disabled]"
|
|
echo
|
|
echo "-q <q> : Compression quality [1 <= <q> <= 100]"
|
|
echo " [default = 95 for JPEG/VGL Transport. Has no effect with"
|
|
echo " X11 Transport]"
|
|
echo
|
|
echo "-samp <s> : Chrominance subsampling factor"
|
|
echo " <s> = gray, 1x, 2x, 4x"
|
|
echo " [default = 1x for JPEG/VGL Transport. Has no effect with"
|
|
echo " X11 Transport or RGB encoding]"
|
|
echo
|
|
echo "+/-s : Enable/disable SSL encryption of VGL Transport or custom"
|
|
echo " image transport, if applicable."
|
|
echo " [default = disabled. Has no effect on the VGL Transport unless"
|
|
echo " VirtualGL was built with OpenSSL support]"
|
|
echo
|
|
echo "+/-sp : Turn on/off frame spoiling [default = enabled]"
|
|
echo
|
|
echo "-st <s> : left = Send only left eye buffer of stereo application"
|
|
echo " right = Send only right eye buffer of stereo application"
|
|
echo " quad = Use quad-buffered stereo if available, otherwise use"
|
|
echo " red/cyan (anaglyphic) stereo [default]"
|
|
echo " rc = Always use red/cyan (anaglyphic) stereo"
|
|
echo
|
|
echo "+/-sync : Enable/disable strict 2D/3D synchronization [default = disabled]"
|
|
echo
|
|
echo "+/-tr : Enable/disable function call tracing (generates a lot of output)"
|
|
echo " [default = disabled]"
|
|
echo
|
|
echo "-trans <t>: Use transport plugin contained in library libvgltrans_<t>.so"
|
|
echo
|
|
echo "+/-v : Enable/disable verbose VirtualGL messages [default = disabled]"
|
|
echo
|
|
echo "-64 : (Solaris only) Preload VirtualGL only into 64-bit apps"
|
|
echo "-32 : (Solaris only) Preload VirtualGL only into 32-bit apps"
|
|
echo
|
|
exit $1
|
|
}
|
|
|
|
GEOPROBE_USEGLX=1
|
|
export GEOPROBE_USEGLX
|
|
PROMAGIC_USEGLX=1
|
|
export PROMAGIC_USEGLX
|
|
|
|
if [ "$OPENGL_DEVICE" != "" ]; then
|
|
echo "[VGL] NOTICE: The OPENGL_DEVICE environment variable is incompatible with"
|
|
echo "[VGL] VirtualGL. Temporarily unsetting this environment variable."
|
|
fi
|
|
unset OPENGL_DEVICE
|
|
export OPENGL_DEVICE
|
|
|
|
__VGL_DL=1
|
|
__VGL_GE=0
|
|
__VGL_64=0
|
|
__VGL_32=0
|
|
|
|
while [ $# -gt 0 ]
|
|
do
|
|
case "$1" in
|
|
+sy*) VGL_SYNC=1 ; export VGL_SYNC ;;
|
|
-sy*) VGL_SYNC=0 ; export VGL_SYNC ;;
|
|
-st*) VGL_STEREO=$2 ; export VGL_STEREO ; shift ;;
|
|
+sp*) VGL_SPOIL=1 ; export VGL_SPOIL ;;
|
|
-sp*) VGL_SPOIL=0 ; export VGL_SPOIL ;;
|
|
-sa*) VGL_SUBSAMP=$2 ; export VGL_SUBSAMP ; shift ;;
|
|
-s*) VGL_SSL=0 ; export VGL_SSL ;;
|
|
+s*) VGL_SSL=1 ; export VGL_SSL ;;
|
|
-prog*) VGL_PROGRESSIVE=0 ; export VGL_PROGRESSIVE ;;
|
|
+prog*) VGL_PROGRESSIVE=1 ; export VGL_PROGRESSIVE ;;
|
|
-pr*) VGL_PROFILE=0 ; export VGL_PROFILE ;;
|
|
+pr*) VGL_PROFILE=1 ; export VGL_PROFILE ;;
|
|
-q*) VGL_QUAL=$2 ; export VGL_QUAL ; shift ;;
|
|
+de*) VGL_DEBUG=1 ; export VGL_DEBUG ;;
|
|
-de*) VGL_DEBUG=0 ; export VGL_DEBUG ;;
|
|
-nodl) __VGL_DL=0 ;;
|
|
-trans*) VGL_TRANSPORT=$2 ; export VGL_TRANSPORT; shift ;;
|
|
+tr*) VGL_TRACE=1 ; export VGL_TRACE ;;
|
|
-tr*) VGL_TRACE=0 ; export VGL_TRACE ;;
|
|
-d*) VGL_DISPLAY=$2 ; export VGL_DISPLAY ; shift ;;
|
|
-cl*) VGL_CLIENT=$2 ; export VGL_CLIENT ; shift ;;
|
|
-p*) VGL_PORT=$2 ; export VGL_PORT ; shift ;;
|
|
-c*) VGL_COMPRESS=$2 ; export VGL_COMPRESS ; shift ;;
|
|
-np*) VGL_NPROCS=$2 ; export VGL_NPROCS ; shift ;;
|
|
-gamma) VGL_GAMMA=$2 ; export VGL_GAMMA ; shift ;;
|
|
-ge) __VGL_GE=1 ;;
|
|
-g*) VGL_GAMMA=0 ; export VGL_GAMMA ;;
|
|
+g*) VGL_GAMMA=1 ; export VGL_GAMMA ;;
|
|
-v*) VGL_VERBOSE=0 ; export VGL_VERBOSE ;;
|
|
+v*) VGL_VERBOSE=1 ; export VGL_VERBOSE ;;
|
|
-fps) VGL_FPS=$2 ; export VGL_FPS ; shift ;;
|
|
-ms) VGL_SAMPLES=$2 ; export VGL_SAMPLES ; shift ;;
|
|
-ld) LD_LIBRARY_PATH=$2:$LD_LIBRARY_PATH ;
|
|
export LD_LIBRARY_PATH ; shift ;;
|
|
-64) __VGL_64=1; __VGL_32=0 ;;
|
|
-32) __VGL_32=1; __VGL_64=0 ;;
|
|
-h) usage 0 ;;
|
|
--help) usage 0 ;;
|
|
--) shift ; break ;;
|
|
-*) usage 1 ;;
|
|
*) break ;;
|
|
esac
|
|
shift
|
|
done
|
|
if [ $# -eq 0 ]
|
|
then
|
|
usage 0
|
|
fi
|
|
|
|
if [ -r /etc/opt/VirtualGL/vgl_xauth_key ]; then
|
|
XAUTH=xauth
|
|
if [ -x /usr/X11R6/bin/xauth ]; then
|
|
XAUTH=/usr/X11R6/bin/xauth
|
|
fi
|
|
if [ -x /usr/openwin/bin/xauth ]; then
|
|
XAUTH=/usr/openwin/bin/xauth
|
|
fi
|
|
$XAUTH merge /etc/opt/VirtualGL/vgl_xauth_key
|
|
fi
|
|
|
|
SSH_IP=`echo $SSH_CLIENT | cut -d' ' -f1 | cut -d: -f4`
|
|
if [ -z "$DISPLAY" ]; then
|
|
if [ ! -z "$SSH_IP" ]; then
|
|
DISPLAY=$SSH_IP:0.0
|
|
export DISPLAY
|
|
echo "[VGL] NOTICE: Automatically setting the DISPLAY environment variable to"
|
|
echo "[VGL] $DISPLAY, based on the IP address of your SSh client."
|
|
fi
|
|
else
|
|
DISPLAYHOST=`echo $DISPLAY | cut -d: -f1`
|
|
if [ "$DISPLAYHOST" = "localhost" -o "$DISPLAYHOST" = "`hostname`" ]; then
|
|
if [ ! -z "$SSH_IP" -a -z "$VGL_CLIENT" -a -z "$RRCLIENT" ]; then
|
|
VGL_CLIENT=$SSH_IP:0.0
|
|
export VGL_CLIENT
|
|
echo "[VGL] NOTICE: Automatically setting VGL_CLIENT environment variable to"
|
|
echo "[VGL] $SSH_IP, the IP address of your SSh client."
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
case `uname -s` in
|
|
|
|
SunOS)
|
|
|
|
if [ -z "$FAKERLIB" ]; then
|
|
FAKERLIB=librrfaker.so
|
|
if [ -f /opt/VirtualGL/lib/64/librrfaker.so ]
|
|
then
|
|
FAKERLIB=/opt/VirtualGL/lib/64/librrfaker.so
|
|
fi
|
|
fi
|
|
export FAKERLIB
|
|
if [ -z "$FAKERLIB32" ]; then
|
|
FAKERLIB32=librrfaker.so
|
|
if [ -f /opt/VirtualGL/lib/librrfaker.so ]
|
|
then
|
|
FAKERLIB32=/opt/VirtualGL/lib/librrfaker.so
|
|
fi
|
|
fi
|
|
export FAKERLIB32
|
|
if [ $__VGL_64 -eq 0 ]; then
|
|
if [ -z "$LD_PRELOAD_32" ]; then
|
|
LD_PRELOAD_32=$FAKERLIB32
|
|
else
|
|
LD_PRELOAD_32=$FAKERLIB32:$LD_PRELOAD_32
|
|
fi
|
|
if [ $__VGL_DL -eq 1 ]; then
|
|
if [ -f /opt/VirtualGL/lib/libdlfaker.so ]
|
|
then
|
|
LD_PRELOAD_32=/opt/VirtualGL/lib/libdlfaker.so:$LD_PRELOAD_32
|
|
else
|
|
LD_PRELOAD_32=libdlfaker.so:$LD_PRELOAD_32
|
|
fi
|
|
fi
|
|
if [ $__VGL_GE -eq 1 ]; then
|
|
if [ -f /opt/VirtualGL/lib/libgefaker.so ]
|
|
then
|
|
LD_PRELOAD_32=/opt/VirtualGL/lib/libgefaker.so:$LD_PRELOAD_32
|
|
else
|
|
LD_PRELOAD_32=libgefaker.so:$LD_PRELOAD_32
|
|
fi
|
|
fi
|
|
export LD_PRELOAD_32
|
|
fi
|
|
if [ $__VGL_32 -eq 0 ]; then
|
|
if [ -z "$LD_PRELOAD_64" ]; then
|
|
LD_PRELOAD_64=$FAKERLIB
|
|
else
|
|
LD_PRELOAD_64=$FAKERLIB:$LD_PRELOAD_64
|
|
fi
|
|
if [ $__VGL_DL -eq 1 ]; then
|
|
if [ -f /opt/VirtualGL/lib/64/libdlfaker.so ]
|
|
then
|
|
LD_PRELOAD_64=/opt/VirtualGL/lib/64/libdlfaker.so:$LD_PRELOAD_64
|
|
else
|
|
LD_PRELOAD_64=libdlfaker.so:$LD_PRELOAD_64
|
|
fi
|
|
fi
|
|
if [ $__VGL_GE -eq 1 ]; then
|
|
if [ -f /opt/VirtualGL/lib/64/libgefaker.so ]
|
|
then
|
|
LD_PRELOAD_64=/opt/VirtualGL/lib/64/libgefaker.so:$LD_PRELOAD_64
|
|
else
|
|
LD_PRELOAD_64=libgefaker.so:$LD_PRELOAD_64
|
|
fi
|
|
fi
|
|
export LD_PRELOAD_64
|
|
fi
|
|
exec ${1+"$@"}
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
if [ -z "$LD_PRELOAD" ]; then
|
|
LD_PRELOAD=librrfaker.so
|
|
else
|
|
LD_PRELOAD=librrfaker.so:$LD_PRELOAD
|
|
fi
|
|
if [ $__VGL_DL -eq 1 ]; then
|
|
LD_PRELOAD=libdlfaker.so:$LD_PRELOAD
|
|
fi
|
|
if [ $__VGL_GE -eq 1 ]; then
|
|
LD_PRELOAD=libgefaker.so:$LD_PRELOAD
|
|
fi
|
|
export LD_PRELOAD
|
|
exec ${1+"$@"}
|
|
|
|
;;
|
|
|
|
esac
|