From 49846bce691962e926b81f9ec86336487f64505b Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 1 Jul 2009 07:32:38 +0000 Subject: - Fixed: JOGL Cg Dependencies .. - Cg classes reside in jogl.cg.jar - Restrict native Cg library dependency only to the jogl cg library, which is loaded from the CgGL class only. - Tested Cg demos with and w/o Cg installation, tested regular GL demos with and w/o Cg installation. (Linux & MacOSX) - jogl/etc/profile.jogl - Changed invocation: $0 [jogl-build-dir] - Autodetects if used from within a autobuild directory - Added it to the autobuild zip file - Fixed: NativeWindow X11GraphicsScreen, adding missing Toolkit locks - Set RI to true ! git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@2009 232f8b59-042b-4e1e-8c03-345bb8c30851 --- etc/profile.jogl | 75 ++++++--- make/build-jogl.xml | 171 +++++++++++++-------- make/build.xml | 6 + make/make.jogl.all.linux-x86.sh | 3 +- make/make.jogl.all.linux-x86_64.sh | 3 +- make/make.jogl.all.macosx.sh | 2 +- make/make.jogl.all.win32.bat | 3 +- make/versions.xml | 3 + .../media/nativewindow/x11/X11GraphicsScreen.java | 21 ++- 9 files changed, 193 insertions(+), 94 deletions(-) diff --git a/etc/profile.jogl b/etc/profile.jogl index 517e39b65..5ed6e01d7 100755 --- a/etc/profile.jogl +++ b/etc/profile.jogl @@ -1,10 +1,15 @@ #! /bin/sh +function print_usage() +{ + echo "Usage: $0 {JOGL_ALL|JOGL_ES1_MIN|JOGL_ES1_MAX|JOGL_ES2_MIN|JOGL_ES2_MAX|JOGL_GL2ES12_MIN|JOGL_GL2ES12_MAX|JOGL_GL2_MIN|JOGL_GL2_MAX} [jogl-build-dir]" +} + function concat_jogl_list() { ITEMDIR=$1 shift - for j in $ITEMDIR/nativewindow $ITEMDIR/jogl $ITEMDIR/newt ; do + for j in $ITEMDIR/nativewindow $ITEMDIR/jogl $ITEMDIR/newt $ITEMDIR ; do for i in $* ; do if [ -e $j/$i ] ; then if [ -z "$JOGL_LIST" ] ; then @@ -25,7 +30,7 @@ JOGL_AWT="jogl.awt.jar jogl.util.awt.jar newt.awt.jar nativewindow.awt.jar" JOGL_CORE="nativewindow.core.jar jogl.core.jar newt.core.jar newt.ogl.jar jogl.util.jar" -JOGL_JAR_ALL="$JOGL_CORE jogl.gles1.jar jogl.gles1.dbg.jar jogl.gles2.jar jogl.gles2.dbg.jar jogl.egl.jar jogl.gl2es12.$OSS.jar jogl.gl2es12.dbg.jar jogl.gl2.$OSS.jar jogl.gl2.dbg.jar jogl.util.gl2.jar jogl.glu.tess.jar jogl.glu.mipmap.jar jogl.glu.gl2.jar jogl.util.gl2.jar jogl.util.fixedfuncemu.jar $JOGL_AWT" +JOGL_JAR_ALL="$JOGL_CORE jogl.gles1.jar jogl.gles1.dbg.jar jogl.gles2.jar jogl.gles2.dbg.jar jogl.egl.jar jogl.gl2es12.$OSS.jar jogl.gl2es12.dbg.jar jogl.gl2.$OSS.jar jogl.gl2.dbg.jar jogl.util.gl2.jar jogl.glu.tess.jar jogl.glu.mipmap.jar jogl.glu.gl2.jar jogl.util.gl2.jar jogl.util.fixedfuncemu.jar $JOGL_AWT jogl.cg.jar" JOGL_LIB_ALL="libjogl_gl2.so libjogl_es1.so libjogl_es2.so libnewt.so libjogl_awt.so" JOGL_JAR_ES1_MIN="$JOGL_CORE jogl.gles1.jar jogl.egl.jar" @@ -44,55 +49,81 @@ JOGL_LIB_GL2ES12_MIN="libjogl_gl2es12.so libnewt.so libnativewindow_x11.so libna JOGL_LIB_GL2ES12_MAX="libjogl_gl2es12.so libnewt.so libnativewindow_x11.so libnativewindow_awt.so" JOGL_JAR_GL2_MIN="$JOGL_CORE jogl.gl2.$OSS.jar" -JOGL_JAR_GL2_MAX="$JOGL_CORE jogl.gl2.$OSS.jar jogl.gl2.dbg.jar jogl.glu.tess.jar jogl.glu.mipmap.jar jogl.glu.gl2.jar jogl.util.gl2.jar $JOGL_AWT" +JOGL_JAR_GL2_MAX="$JOGL_CORE jogl.gl2.$OSS.jar jogl.gl2.dbg.jar jogl.glu.tess.jar jogl.glu.mipmap.jar jogl.glu.gl2.jar jogl.util.gl2.jar $JOGL_AWT jogl.cg.jar" JOGL_LIB_GL2_MIN="libjogl_gl2.so libnewt.so libnativewindow_x11.so libnativewindow_awt.so" JOGL_LIB_GL2_MAX="libjogl_gl2.so libnewt.so libnativewindow_x11.so libnativewindow_awt.so" export JOGL_JAR_ALL JOGL_JAR_ES1_MIN JOGL_JAR_ES1_MAX JOGL_JAR_ES2_MIN JOGL_JAR_ES2_MAX JOGL_JAR_GL2ES12_MIN JOGL_JAR_GL2ES12_MAX JOGL_JAR_GL2_MIN JOGL_JAR_GL2_MAX export JOGL_LIB_ALL JOGL_LIB_ES1_MIN JOGL_LIB_ES1_MAX JOGL_LIB_ES2_MIN JOGL_LIB_ES2_MAX JOGL_LIB_GL2ES12_MIN JOGL_LIB_GL2ES12_MAX JOGL_LIB_GL2_MIN JOGL_LIB_GL2_MAX -JOGL_JAR_DIR="" -if [ ! -z "$1" ] ; then - JOGL_JAR_DIR="$1" - shift -fi -export JOGL_JAR_DIR +THISDIR=`dirname $0` + +JOGL_PROFILE="$1" +shift -JOGL_LIB_DIR=$JOGL_JAR_DIR/nativewindow/obj:$JOGL_JAR_DIR/jogl/obj:$JOGL_JAR_DIR/newt/obj +if [ -z "$JOGL_PROFILE" ] ; then + echo JOGL PROFILE missing + print_usage +fi + +JOGL_BUILD_DIR="$1" +shift + +AUTOBUILD=0 + +if [ ! -z "$JOGL_BUILD_DIR" -a -e "$JOGL_BUILD_DIR" ] ; then + AUTOBUILD=0 +elif [ -e $THISDIR/../lib ] ; then + # Autobuild + JOGL_BUILD_DIR=$THISDIR/../lib + AUTOBUILD=1 +else + echo invalid JOGL_BUILD_DIR $JOGL_BUILD_DIR and no AUTOBUILD + print_usage +fi +export JOGL_BUILD_DIR + +JOGL_LIB_DIR="" +if [ $AUTOBUILD -eq 0 ] ; then + JOGL_LIB_DIR=$JOGL_BUILD_DIR/nativewindow/obj:$JOGL_BUILD_DIR/jogl/obj:$JOGL_BUILD_DIR/newt/obj +else + # Autobuild + JOGL_LIB_DIR=$THISDIR/../lib +fi export JOGL_LIB_DIR -if [ ! -z "$1" ] ; then - case "$1" in +if [ ! -z "$JOGL_PROFILE" ] ; then + case "$JOGL_PROFILE" in JOGL_ALL) - JOGL_CLASSPATH=$(concat_jogl_list $JOGL_JAR_DIR $JOGL_JAR_ALL) + JOGL_CLASSPATH=$(concat_jogl_list $JOGL_BUILD_DIR $JOGL_JAR_ALL) ;; JOGL_ES1_MIN) - JOGL_CLASSPATH=$(concat_jogl_list $JOGL_JAR_DIR $JOGL_JAR_ES1_MIN) + JOGL_CLASSPATH=$(concat_jogl_list $JOGL_BUILD_DIR $JOGL_JAR_ES1_MIN) JOGL_VBO_BUG=true ; export JOGL_VBO_BUG # ES emulation has buggy VBO impl. ;; JOGL_ES1_MAX) - JOGL_CLASSPATH=$(concat_jogl_list $JOGL_JAR_DIR $JOGL_JAR_ES1_MAX) + JOGL_CLASSPATH=$(concat_jogl_list $JOGL_BUILD_DIR $JOGL_JAR_ES1_MAX) JOGL_VBO_BUG=true ; export JOGL_VBO_BUG # ES emulation has buggy VBO impl. ;; JOGL_ES2_MIN) - JOGL_CLASSPATH=$(concat_jogl_list $JOGL_JAR_DIR $JOGL_JAR_ES2_MIN) + JOGL_CLASSPATH=$(concat_jogl_list $JOGL_BUILD_DIR $JOGL_JAR_ES2_MIN) JOGL_VBO_BUG=true ; export JOGL_VBO_BUG # ES emulation has buggy VBO impl. ;; JOGL_ES2_MAX) - JOGL_CLASSPATH=$(concat_jogl_list $JOGL_JAR_DIR $JOGL_JAR_ES2_MAX) + JOGL_CLASSPATH=$(concat_jogl_list $JOGL_BUILD_DIR $JOGL_JAR_ES2_MAX) JOGL_VBO_BUG=true ; export JOGL_VBO_BUG # ES emulation has buggy VBO impl. ;; JOGL_GL2ES12_MIN) - JOGL_CLASSPATH=$(concat_jogl_list $JOGL_JAR_DIR $JOGL_JAR_GL2ES12_MIN) + JOGL_CLASSPATH=$(concat_jogl_list $JOGL_BUILD_DIR $JOGL_JAR_GL2ES12_MIN) ;; JOGL_GL2ES12_MAX) - JOGL_CLASSPATH=$(concat_jogl_list $JOGL_JAR_DIR $JOGL_JAR_GL2ES12_MAX) + JOGL_CLASSPATH=$(concat_jogl_list $JOGL_BUILD_DIR $JOGL_JAR_GL2ES12_MAX) ;; JOGL_GL2_MIN) - JOGL_CLASSPATH=$(concat_jogl_list $JOGL_JAR_DIR $JOGL_JAR_GL2_MIN) + JOGL_CLASSPATH=$(concat_jogl_list $JOGL_BUILD_DIR $JOGL_JAR_GL2_MIN) ;; JOGL_GL2_MAX) - JOGL_CLASSPATH=$(concat_jogl_list $JOGL_JAR_DIR $JOGL_JAR_GL2_MAX) + JOGL_CLASSPATH=$(concat_jogl_list $JOGL_BUILD_DIR $JOGL_JAR_GL2_MAX) ;; esac @@ -100,6 +131,6 @@ if [ ! -z "$1" ] ; then fi if [ -z "$JOGL_CLASSPATH" ] ; then - echo "Usage: $0 {JOGL_ALL|JOGL_ES1_MIN|JOGL_ES1_MAX|JOGL_ES2_MIN|JOGL_ES2_MAX|JOGL_GL2ES12_MIN|JOGL_GL2ES12_MAX|JOGL_GL2_MIN|JOGL_GL2_MAX}" + print_usage fi diff --git a/make/build-jogl.xml b/make/build-jogl.xml index 8f7a4ac5d..e23b9d594 100644 --- a/make/build-jogl.xml +++ b/make/build-jogl.xml @@ -37,7 +37,10 @@ - - Optional properties: - -Djogl.cg=1 when combined with the build or javadoc targets will cause - - the experimental binding to NVidia's Cg language to be built. + - the experimental binding to NVidia's Cg language to be built. + - Then you need to define the location of your CG libraries: + - -Dwindows.cg.lib= for Windows and + - -Dx11.cg.lib= for X11/Unix - - Thanks to Rob Grzywinski and Artur Biesiadowski for the bulk of the - ANT build, including the GlueGen and StaticGLInfo tasks, the building of @@ -146,6 +149,11 @@ + + + + @@ -225,6 +233,13 @@ + + + + + + @@ -289,14 +304,9 @@ - + - - - - - @@ -460,6 +470,7 @@ + @@ -1255,7 +1266,10 @@ - + + + + @@ -1265,16 +1279,22 @@ - + + + + - + - + + + + @@ -1292,23 +1312,32 @@ - + + + + - + + + + - - + + + + + @@ -1323,6 +1352,7 @@ + @@ -1331,6 +1361,7 @@ + @@ -1339,6 +1370,7 @@ + @@ -1347,6 +1379,7 @@ + @@ -1355,6 +1388,7 @@ + @@ -1365,6 +1399,7 @@ + @@ -1374,6 +1409,7 @@ + @@ -1383,6 +1419,7 @@ + @@ -1391,6 +1428,7 @@ + @@ -1399,6 +1437,7 @@ + @@ -1410,6 +1449,7 @@ + @@ -1528,7 +1568,7 @@ - + @@ -1602,7 +1642,7 @@ + linker.cfg.id="${linker.cfg.id.cg}"/> @@ -1632,141 +1672,147 @@ - + - - - - - - - - - - - + + + + + + + + - - - - - - + tofile="${build}/tempversion" + overwrite="true"> + + + + + + + + + + + + + - + + + excludes="${java.excludes.fixme}, ${java.part.cg}, ${java.part.egl}, ${java.part.sdk}, ${java.part.openmax}, ${java.part.gl2es12.x11}, ${java.part.gl2es12.win}, ${java.part.gl2es12.osx}, ${java.part.gl2es12.dbg}, ${java.part.gl2.x11}, ${java.part.gl2.win}, ${java.part.gl2.osx}, ${java.part.gl2.dbg}, ${java.part.es1}, ${java.part.es1.dbg}, ${java.part.es2}, ${java.part.es2.dbg}, ${java.part.awt}, ${java.part.glutess}, ${java.part.glumipmap}, ${java.part.glugl2}, ${java.part.util} ${java.part.util.awt} ${java.part.util.gl2} ${java.part.util.glsl} ${java.part.util.fixedfuncemu}"/> - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1778,7 +1824,6 @@ - diff --git a/make/build.xml b/make/build.xml index 30ca60cfe..a3f0530d1 100644 --- a/make/build.xml +++ b/make/build.xml @@ -124,6 +124,11 @@ + + + + + @@ -143,6 +148,7 @@ archiving binary bits from other rootrel.build settings in the source archive. This is inevitable given that we don't want to specialize this target to explicitly include top level files and directories, to make it future-proof. --> + &1 | tee make.jogl.all.macosx.log diff --git a/make/make.jogl.all.win32.bat b/make/make.jogl.all.win32.bat index 54475db06..c53007f44 100644 --- a/make/make.jogl.all.win32.bat +++ b/make/make.jogl.all.win32.bat @@ -7,5 +7,6 @@ set CLASSPATH=.;%THISDIR%\build-win32\classes REM -Dc.compiler.debug=true REM -DuseOpenMAX=true REM -DuseKD=true +REM -Djogl.cg=1 -D-Dwindows.cg.lib=C:\Cg-2.2 -ant -Drootrel.build=build-win32 > make.jogl.all.win32.log 2>&1 +ant -Drootrel.build=build-win32 -Djogl.cg=1 -D-Dwindows.cg.lib=C:\Cg-2.2 > make.jogl.all.win32.log 2>&1 diff --git a/make/versions.xml b/make/versions.xml index 75c035f5a..0ee07bfe0 100644 --- a/make/versions.xml +++ b/make/versions.xml @@ -19,6 +19,7 @@ official release builds and intermediate release builds, but commented out for nightly builds. --> + @@ -30,6 +31,7 @@ official release builds and intermediate release builds, but commented out for nightly builds. --> + @@ -42,5 +44,6 @@ official release builds and intermediate release builds, but commented out for nightly builds. --> + diff --git a/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java b/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java index 34bc48f99..45146d33e 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java +++ b/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java @@ -56,9 +56,14 @@ public class X11GraphicsScreen extends DefaultGraphicsScreen implements Cloneabl /** Creates a new X11GraphicsScreen using a thread local display connection */ public static AbstractGraphicsScreen createDefault() { - long display = X11Util.getThreadLocalDefaultDisplay(); - int scrnIdx = X11Lib.DefaultScreen(display); - return createScreenDevice(display, scrnIdx); + NativeWindowFactory.getDefaultFactory().getToolkitLock().lock(); + try { + long display = X11Util.getThreadLocalDefaultDisplay(); + int scrnIdx = X11Lib.DefaultScreen(display); + return createScreenDevice(display, scrnIdx); + } finally { + NativeWindowFactory.getDefaultFactory().getToolkitLock().unlock(); + } } public long getDefaultVisualID() { @@ -74,8 +79,14 @@ public class X11GraphicsScreen extends DefaultGraphicsScreen implements Cloneabl } private static int fetchScreen(X11GraphicsDevice device, int screen) { - if(!X11Lib.XineramaEnabled(device.getHandle())) { - return screen; + // It still could be an AWT hold handle .. + NativeWindowFactory.getDefaultFactory().getToolkitLock().lock(); + try { + if(!X11Lib.XineramaEnabled(device.getHandle())) { + return screen; + } + } finally { + NativeWindowFactory.getDefaultFactory().getToolkitLock().unlock(); } return 0; } -- cgit v1.2.3