From 3f72e907e869370b98dc7519ae5fc53681376450 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Sat, 27 Mar 2010 23:28:04 +0100 Subject: refactoring part 3 (impl package): renamed com.sun.opengl -> com.jogamp.opengl. --- .../classes/com/jogamp/opengl/impl/DRIHack.java | 127 +++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100755 src/jogl/classes/com/jogamp/opengl/impl/DRIHack.java (limited to 'src/jogl/classes/com/jogamp/opengl/impl/DRIHack.java') diff --git a/src/jogl/classes/com/jogamp/opengl/impl/DRIHack.java b/src/jogl/classes/com/jogamp/opengl/impl/DRIHack.java new file mode 100755 index 000000000..ede966259 --- /dev/null +++ b/src/jogl/classes/com/jogamp/opengl/impl/DRIHack.java @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.jogamp.opengl.impl; + +import java.io.*; +import java.security.*; +import com.jogamp.gluegen.runtime.*; + +/** + * Helper class for working around problems with open-source DRI + * drivers. In the current DRI implementation it is required that the + * symbols in libGL.so.1.2 be globally visible to be accessible from + * other libraries that are dynamically loaded by the implementation. + * Applications may typically satisfy this need either by linking + * against libGL.so on the command line (-lGL) or by dlopen'ing + * libGL.so.1.2 with the RTLD_GLOBAL flag. The JOGL implementation + * links against libGL on all platforms rather than forcing all OpenGL + * entry points to be called through a function pointer. This allows + * the JOGL library to link directly to core 1.1 OpenGL entry points + * like glVertex3f, while calling through function pointers for entry + * points from later OpenGL versions as well as from + * extensions. However, because libjogl.so (which links against + * libGL.so) is loaded by the JVM, and because the JVM implicitly uses + * RTLD_LOCAL in the implementation of System.loadLibrary(), this + * means via transitivity that the symbols for libGL.so have only + * RTLD_LOCAL visibility to the rest of the application, so the DRI + * drivers can not find the symbols required.

+ * + * There are at least two possible solutions. One would be to change + * the JOGL implementation to call through function pointers uniformly + * so that it does not need to link against libGL.so. This is + * possible, but requires changes to GlueGen and also is not really + * necessary in any other situation than with the DRI drivers. Another + * solution is to force the first load of libGL.so.1.2 to be done + * dynamically with RTLD_GLOBAL before libjogl.so is loaded and causes + * libGL.so.1.2 to be loaded again. The NativeLibrary class in the + * GlueGen runtime has this property, and we use it to implement this + * workaround. + */ + +public class DRIHack { + private static final boolean DEBUG = Debug.debug("DRIHack"); + private static boolean driHackNeeded; + private static NativeLibrary oglLib; + + public static void begin() { + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + String os = Debug.getProperty("os.name", false).toLowerCase(); + // Do DRI hack on all Linux distributions for best robustness + driHackNeeded = + (os.startsWith("linux") || + new File("/usr/lib/dri").exists() || + new File("/usr/X11R6/lib/modules/dri").exists()); + // Allow manual overriding for now as a workaround for + // problems seen in some situations -- needs more investigation + if (Debug.getProperty("jogl.drihack.disable", true) != null) { + driHackNeeded = false; + } + return null; + } + }); + + if (driHackNeeded) { + if (DEBUG) { + System.err.println("Beginning DRI hack"); + } + + // Try a few different variants for best robustness + // In theory probably only the first is necessary + oglLib = NativeLibrary.open("libGL.so.1", null); + if (DEBUG && oglLib != null) System.err.println(" Found libGL.so.1"); + if (oglLib == null) { + oglLib = NativeLibrary.open("/usr/lib/libGL.so.1", null); + if (DEBUG && oglLib != null) System.err.println(" Found /usr/lib/libGL.so.1"); + } + } + } + + public static void end() { + if (oglLib != null) { + if (DEBUG) { + System.err.println("Ending DRI hack"); + } + + oglLib.close(); + oglLib = null; + } + } +} -- cgit v1.2.3 From 3046f4a785d8be1dcd491d864c17c92b6c52fbdd Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Wed, 31 Mar 2010 23:57:06 +0200 Subject: modifications due to class movement in gluegen. updated joglversion files. --- make/config/jogl/glx-CustomJavaCode.java | 2 +- make/joglversion | 4 ++-- make/joglversion-cdc | 4 ++-- src/jogl/classes/com/jogamp/opengl/impl/DRIHack.java | 2 +- src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java | 2 +- src/jogl/classes/com/jogamp/opengl/impl/GLDrawableImpl.java | 2 +- src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java | 3 +-- src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java | 2 -- .../classes/com/jogamp/opengl/impl/egl/EGLDynamicLookupHelper.java | 5 ++--- .../com/jogamp/opengl/impl/egl/EGLES1DynamicLookupHelper.java | 5 ----- .../com/jogamp/opengl/impl/egl/EGLES2DynamicLookupHelper.java | 5 ----- .../classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfiguration.java | 3 +-- .../com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java | 4 +--- .../classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java | 2 +- .../com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java | 4 +--- .../com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java | 2 +- .../com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java | 2 +- .../com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java | 2 +- .../jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java | 2 +- .../opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java | 2 -- .../com/jogamp/opengl/impl/x11/glx/X11ExternalGLXDrawable.java | 2 -- src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawable.java | 3 +-- .../com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java | 5 +---- .../com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java | 4 +--- .../opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java | 4 +--- src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java | 2 +- src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java | 2 +- src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java | 2 +- src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java | 2 +- src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java | 2 +- .../com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncHook.java | 2 +- .../jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncPipeline.java | 2 +- 32 files changed, 30 insertions(+), 61 deletions(-) (limited to 'src/jogl/classes/com/jogamp/opengl/impl/DRIHack.java') diff --git a/make/config/jogl/glx-CustomJavaCode.java b/make/config/jogl/glx-CustomJavaCode.java index 6ed31990e..fe81cd64a 100644 --- a/make/config/jogl/glx-CustomJavaCode.java +++ b/make/config/jogl/glx-CustomJavaCode.java @@ -13,7 +13,7 @@ /** Interface to C language function:
- Alias for:
GLXFBConfig * glXChooseFBConfigSGIX, glXChooseFBConfig(Display * dpy, int screen, const int * attribList, int * nitems); */ - public static com.jogamp.gluegen.runtime.PointerBuffer glXChooseFBConfigCopied(long dpy, int screen, int[] attribList, int attribList_offset, int[] nitems, int nitems_offset) + public static com.jogamp.common.nio.PointerBuffer glXChooseFBConfigCopied(long dpy, int screen, int[] attribList, int attribList_offset, int[] nitems, int nitems_offset) { if(attribList != null && attribList.length <= attribList_offset) throw new GLException("array offset argument \"attribList_offset\" (" + attribList_offset + ") equals or exceeds array length (" + attribList.length + ")"); diff --git a/make/joglversion b/make/joglversion index d013d0967..b65b6e3b6 100644 --- a/make/joglversion +++ b/make/joglversion @@ -3,6 +3,6 @@ Specification-Version: @BASEVERSION@ Specification-Vendor: Sun Microsystems, Inc. Implementation-Title: Java Bindings for OpenGL Runtime Environment Implementation-Version: @VERSION@ -Implementation-Vendor: java.net JOGL community +Implementation-Vendor: JogAmp community Extension-Name: javax.media.opengl -Implementation-Vendor-Id: com.sun +Implementation-Vendor-Id: com.jogamp diff --git a/make/joglversion-cdc b/make/joglversion-cdc index 5a2950b55..5056fbaf3 100644 --- a/make/joglversion-cdc +++ b/make/joglversion-cdc @@ -3,6 +3,6 @@ Specification-Version: @BASEVERSION@ Specification-Vendor: Sun Microsystems, Inc. Implementation-Title: Java Bindings for OpenGL Runtime Environment CDC Implementation-Version: @VERSION@ -Implementation-Vendor: java.net JOGL community +Implementation-Vendor: JogAmp community Extension-Name: javax.media.opengl -Implementation-Vendor-Id: com.sun +Implementation-Vendor-Id: com.jogamp diff --git a/src/jogl/classes/com/jogamp/opengl/impl/DRIHack.java b/src/jogl/classes/com/jogamp/opengl/impl/DRIHack.java index ede966259..e845ef160 100755 --- a/src/jogl/classes/com/jogamp/opengl/impl/DRIHack.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/DRIHack.java @@ -39,9 +39,9 @@ package com.jogamp.opengl.impl; +import com.jogamp.common.os.NativeLibrary; import java.io.*; import java.security.*; -import com.jogamp.gluegen.runtime.*; /** * Helper class for working around problems with open-source DRI diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java index 49045910a..893827a8c 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java @@ -39,8 +39,8 @@ package com.jogamp.opengl.impl; +import com.jogamp.common.os.DynamicLookupHelper; import java.nio.*; -import java.lang.reflect.*; import javax.media.opengl.*; import com.jogamp.nativewindow.impl.NWReflection; diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableImpl.java index 20bf20c20..10c70db99 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableImpl.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableImpl.java @@ -39,9 +39,9 @@ package com.jogamp.opengl.impl; +import com.jogamp.common.os.DynamicLookupHelper; import javax.media.nativewindow.*; import javax.media.opengl.*; -import com.jogamp.gluegen.runtime.DynamicLookupHelper; public abstract class GLDrawableImpl implements GLDrawable { protected static final boolean DEBUG = Debug.debug("GLDrawable"); diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java index db5ee6ac6..dcfe06bdc 100755 --- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java @@ -35,9 +35,8 @@ package com.jogamp.opengl.impl.egl; +import com.jogamp.common.os.DynamicLookupHelper; import com.jogamp.opengl.impl.GLDrawableImpl; -import com.jogamp.nativewindow.impl.NWReflection; -import com.jogamp.gluegen.runtime.DynamicLookupHelper; import javax.media.nativewindow.*; import javax.media.nativewindow.egl.*; diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java index d50f671a3..34b039b3a 100755 --- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java @@ -35,12 +35,10 @@ package com.jogamp.opengl.impl.egl; -import java.util.*; import javax.media.nativewindow.*; import javax.media.opengl.*; import com.jogamp.opengl.impl.*; import com.jogamp.nativewindow.impl.*; -import com.jogamp.gluegen.runtime.NativeLibrary; public class EGLDrawableFactory extends GLDrawableFactoryImpl { diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDynamicLookupHelper.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDynamicLookupHelper.java index 4918acbb3..70f0540bf 100755 --- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDynamicLookupHelper.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDynamicLookupHelper.java @@ -35,13 +35,12 @@ package com.jogamp.opengl.impl.egl; +import com.jogamp.common.os.DynamicLookupHelper; +import com.jogamp.common.os.NativeLibrary; import java.util.*; import javax.media.nativewindow.*; import javax.media.opengl.*; import com.jogamp.opengl.impl.*; -import com.jogamp.nativewindow.impl.*; -import com.jogamp.gluegen.runtime.NativeLibrary; -import com.jogamp.gluegen.runtime.DynamicLookupHelper; import java.security.*; /** diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES1DynamicLookupHelper.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES1DynamicLookupHelper.java index 5c4da5098..e5740a4f0 100755 --- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES1DynamicLookupHelper.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES1DynamicLookupHelper.java @@ -36,11 +36,6 @@ package com.jogamp.opengl.impl.egl; import java.util.*; -import javax.media.nativewindow.*; -import javax.media.opengl.*; -import com.jogamp.opengl.impl.*; -import com.jogamp.nativewindow.impl.*; -import com.jogamp.gluegen.runtime.NativeLibrary; /** * Implementation of the EGLDynamicLookupHelper for ES1. diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES2DynamicLookupHelper.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES2DynamicLookupHelper.java index 0b499c204..c4fc66630 100755 --- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES2DynamicLookupHelper.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES2DynamicLookupHelper.java @@ -36,11 +36,6 @@ package com.jogamp.opengl.impl.egl; import java.util.*; -import javax.media.nativewindow.*; -import javax.media.opengl.*; -import com.jogamp.opengl.impl.*; -import com.jogamp.nativewindow.impl.*; -import com.jogamp.gluegen.runtime.NativeLibrary; /** * Implementation of the EGLDynamicLookupHelper for ES2. diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfiguration.java index 43c99a422..c8bc4fe0d 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfiguration.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfiguration.java @@ -35,13 +35,12 @@ package com.jogamp.opengl.impl.egl; +import com.jogamp.common.nio.PointerBuffer; import java.util.*; import javax.media.nativewindow.*; import javax.media.nativewindow.egl.*; import javax.media.opengl.*; import com.jogamp.opengl.impl.*; -import com.jogamp.gluegen.runtime.NativeLibrary; -import com.jogamp.gluegen.runtime.PointerBuffer; public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration implements Cloneable { protected static final boolean DEBUG = Debug.debug("GraphicsConfiguration"); diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java index f315a514c..f22661238 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java @@ -32,15 +32,13 @@ package com.jogamp.opengl.impl.egl; +import com.jogamp.common.nio.PointerBuffer; import java.io.PrintStream; import javax.media.nativewindow.*; import javax.media.nativewindow.egl.*; -import com.jogamp.nativewindow.impl.*; import javax.media.opengl.*; -import com.jogamp.opengl.impl.*; -import com.jogamp.gluegen.runtime.PointerBuffer; /** Subclass of GraphicsConfigurationFactory used when non-AWT tookits are used on X11 platforms. Toolkits will likely need to delegate diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java index 2b91eb5d3..5816b2101 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java @@ -42,7 +42,7 @@ package com.jogamp.opengl.impl.macosx.cgl; import javax.media.nativewindow.*; import javax.media.opengl.*; import com.jogamp.opengl.impl.*; -import com.jogamp.gluegen.runtime.DynamicLookupHelper; +import com.jogamp.common.os.DynamicLookupHelper; public abstract class MacOSXCGLDrawable extends GLDrawableImpl { // The Java2D/OpenGL pipeline on OS X uses low-level CGLContextObjs diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java index a3ae6f936..641e482bc 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java @@ -39,14 +39,12 @@ package com.jogamp.opengl.impl.macosx.cgl; -import java.lang.reflect.InvocationTargetException; +import com.jogamp.common.os.DynamicLookupHelper; import java.nio.*; -import java.util.*; import javax.media.nativewindow.*; import javax.media.opengl.*; import com.jogamp.opengl.impl.*; import com.jogamp.nativewindow.impl.*; -import com.jogamp.gluegen.runtime.DynamicLookupHelper; public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl implements DynamicLookupHelper { public MacOSXCGLDrawableFactory() { diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java index aacd2c38e..446f457be 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java @@ -1,12 +1,12 @@ package com.jogamp.opengl.impl.macosx.cgl; +import com.jogamp.common.nio.PointerBuffer; import java.security.*; import java.util.*; import javax.media.opengl.*; import javax.media.nativewindow.*; import com.jogamp.opengl.impl.*; -import com.jogamp.gluegen.runtime.PointerBuffer; public class MacOSXPbufferCGLContext extends MacOSXCGLContext { protected MacOSXPbufferCGLDrawable drawable; diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java index 95609aee5..b02cea03e 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java @@ -39,10 +39,10 @@ package com.jogamp.opengl.impl.macosx.cgl; +import com.jogamp.common.nio.PointerBuffer; import javax.media.opengl.*; import javax.media.nativewindow.*; import com.jogamp.opengl.impl.*; -import com.jogamp.gluegen.runtime.PointerBuffer; public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { private static final boolean DEBUG = Debug.debug("MacOSXPbufferCGLDrawable"); diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java index c76766b2e..fe0945139 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java @@ -39,10 +39,10 @@ package com.jogamp.opengl.impl.windows.wgl; +import com.jogamp.common.os.DynamicLookupHelper; import javax.media.nativewindow.*; import javax.media.opengl.*; import com.jogamp.opengl.impl.*; -import com.jogamp.gluegen.runtime.DynamicLookupHelper; public abstract class WindowsWGLDrawable extends GLDrawableImpl { private static final int MAX_SET_PIXEL_FORMAT_FAIL_COUNT = 5; diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java index 6827c755e..9e458c8d0 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java @@ -39,13 +39,13 @@ package com.jogamp.opengl.impl.windows.wgl; +import com.jogamp.common.os.DynamicLookupHelper; import java.nio.*; import java.util.*; import javax.media.nativewindow.*; import javax.media.opengl.*; import com.jogamp.opengl.impl.*; import com.jogamp.nativewindow.impl.NWReflection; -import com.jogamp.gluegen.runtime.DynamicLookupHelper; import com.jogamp.nativewindow.impl.NullWindow; public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements DynamicLookupHelper { diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java index bb59434b7..5b34e40e1 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java @@ -32,11 +32,9 @@ package com.jogamp.opengl.impl.windows.wgl; -import java.util.*; import javax.media.nativewindow.*; import javax.media.opengl.*; import com.jogamp.opengl.impl.*; -import com.jogamp.gluegen.runtime.NativeLibrary; public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguration implements Cloneable { // Keep this under the same debug flag as the drawable factory for convenience diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXDrawable.java index 44aea0fa7..f10bd38c6 100755 --- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXDrawable.java @@ -44,9 +44,7 @@ import javax.media.nativewindow.x11.*; import javax.media.opengl.*; import com.jogamp.opengl.impl.*; import com.jogamp.nativewindow.impl.NullWindow; -import com.jogamp.nativewindow.impl.x11.*; -import com.jogamp.gluegen.runtime.PointerBuffer; public class X11ExternalGLXDrawable extends X11GLXDrawable { private int fbConfigID; diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawable.java index ee807c32a..2dabe774c 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawable.java @@ -42,8 +42,7 @@ package com.jogamp.opengl.impl.x11.glx; import javax.media.nativewindow.*; import javax.media.opengl.*; import com.jogamp.opengl.impl.*; -import com.jogamp.nativewindow.impl.x11.*; -import com.jogamp.gluegen.runtime.DynamicLookupHelper; +import com.jogamp.common.os.DynamicLookupHelper; public abstract class X11GLXDrawable extends GLDrawableImpl { protected X11GLXDrawable(GLDrawableFactory factory, NativeWindow comp, boolean realized) { diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java index cb25e6723..1a254843e 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java @@ -36,16 +36,13 @@ package com.jogamp.opengl.impl.x11.glx; +import com.jogamp.common.os.DynamicLookupHelper; import java.nio.*; -import java.security.*; -import java.util.*; import javax.media.nativewindow.*; import javax.media.nativewindow.x11.*; import javax.media.opengl.*; -import com.jogamp.gluegen.runtime.*; import com.jogamp.gluegen.runtime.opengl.*; import com.jogamp.opengl.impl.*; -import com.jogamp.opengl.impl.x11.glx.*; import com.jogamp.nativewindow.impl.NullWindow; import com.jogamp.nativewindow.impl.NWReflection; import com.jogamp.nativewindow.impl.x11.*; diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java index f127ec2d0..b3a6e5b8c 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java @@ -32,13 +32,11 @@ package com.jogamp.opengl.impl.x11.glx; -import java.util.*; +import com.jogamp.common.nio.PointerBuffer; import javax.media.nativewindow.*; import javax.media.nativewindow.x11.*; import javax.media.opengl.*; import com.jogamp.opengl.impl.*; -import com.jogamp.gluegen.runtime.NativeLibrary; -import com.jogamp.gluegen.runtime.PointerBuffer; import com.jogamp.nativewindow.impl.x11.*; public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implements Cloneable { diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java index eca5fede5..5f438cb7f 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java @@ -32,16 +32,14 @@ package com.jogamp.opengl.impl.x11.glx; +import com.jogamp.common.nio.PointerBuffer; import javax.media.nativewindow.*; import javax.media.nativewindow.x11.*; -import com.jogamp.nativewindow.impl.NativeWindowFactoryImpl; import com.jogamp.nativewindow.impl.x11.*; import javax.media.opengl.*; import com.jogamp.opengl.impl.*; -import com.jogamp.opengl.impl.x11.glx.*; -import com.jogamp.gluegen.runtime.PointerBuffer; /** Subclass of GraphicsConfigurationFactory used when non-AWT tookits are used on X11 platforms. Toolkits will likely need to delegate diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java index d41e4b922..1141f6624 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java @@ -1,7 +1,7 @@ package com.jogamp.opengl.util; -import com.jogamp.gluegen.runtime.Buffers; +import com.jogamp.common.nio.Buffers; import java.security.*; import javax.media.opengl.*; diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java index b49bb3364..efe3a7675 100755 --- a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java @@ -38,7 +38,7 @@ */ package com.jogamp.opengl.util; -import com.jogamp.gluegen.runtime.Buffers; +import com.jogamp.common.nio.Buffers; import javax.media.opengl.GL; import javax.media.opengl.GL2; import javax.media.opengl.GL2ES2; diff --git a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java index 4ca8ff197..47de8ce0a 100755 --- a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java +++ b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java @@ -33,7 +33,7 @@ package com.jogamp.opengl.util; -import com.jogamp.gluegen.runtime.Buffers; +import com.jogamp.common.nio.Buffers; import com.jogamp.opengl.impl.ProjectFloat; import java.nio.*; diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java index 4de2e5974..bac9f88ea 100755 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java @@ -38,7 +38,7 @@ */ package com.jogamp.opengl.util.awt; -import com.jogamp.gluegen.runtime.Buffers; +import com.jogamp.common.nio.Buffers; import com.jogamp.opengl.impl.Debug; import com.jogamp.opengl.util.*; import com.jogamp.opengl.util.packrect.*; diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java index 94b329cd5..d0e7ea29d 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java @@ -1,7 +1,7 @@ package com.jogamp.opengl.util.glsl; -import com.jogamp.gluegen.runtime.Buffers; +import com.jogamp.common.nio.Buffers; import javax.media.opengl.*; import com.jogamp.opengl.util.*; import com.jogamp.opengl.impl.Debug; diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncHook.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncHook.java index 2276cc835..b8e3922a4 100755 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncHook.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncHook.java @@ -7,7 +7,7 @@ package com.jogamp.opengl.util.glsl.fixedfunc.impl; import javax.media.opengl.*; import javax.media.opengl.fixedfunc.*; import javax.media.opengl.glu.*; -import com.jogamp.gluegen.runtime.Buffers; +import com.jogamp.common.nio.Buffers; import com.jogamp.opengl.util.*; import com.jogamp.opengl.util.glsl.*; import java.nio.*; diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncPipeline.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncPipeline.java index 9ead6c4eb..529e4567b 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncPipeline.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncPipeline.java @@ -1,7 +1,7 @@ package com.jogamp.opengl.util.glsl.fixedfunc.impl; -import com.jogamp.gluegen.runtime.Buffers; +import com.jogamp.common.nio.Buffers; import javax.media.opengl.*; import javax.media.opengl.fixedfunc.*; import com.jogamp.opengl.util.*; -- cgit v1.2.3 From 7deccdaa76305b7acae9dfc7a15f974387c6cd1a Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Sat, 17 Apr 2010 22:40:12 +0200 Subject: DRIHack.driHackNeeded is now initialized once in the static initializer (not in every begin() call). --- .../classes/com/jogamp/opengl/impl/DRIHack.java | 44 +++++++++++++--------- 1 file changed, 27 insertions(+), 17 deletions(-) (limited to 'src/jogl/classes/com/jogamp/opengl/impl/DRIHack.java') diff --git a/src/jogl/classes/com/jogamp/opengl/impl/DRIHack.java b/src/jogl/classes/com/jogamp/opengl/impl/DRIHack.java index e845ef160..7e81d194b 100755 --- a/src/jogl/classes/com/jogamp/opengl/impl/DRIHack.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/DRIHack.java @@ -40,6 +40,7 @@ package com.jogamp.opengl.impl; import com.jogamp.common.os.NativeLibrary; +import com.jogamp.common.os.Platform; import java.io.*; import java.security.*; @@ -76,27 +77,31 @@ import java.security.*; */ public class DRIHack { + private static final boolean DEBUG = Debug.debug("DRIHack"); private static boolean driHackNeeded; private static NativeLibrary oglLib; - public static void begin() { - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - String os = Debug.getProperty("os.name", false).toLowerCase(); - // Do DRI hack on all Linux distributions for best robustness - driHackNeeded = - (os.startsWith("linux") || - new File("/usr/lib/dri").exists() || - new File("/usr/X11R6/lib/modules/dri").exists()); - // Allow manual overriding for now as a workaround for - // problems seen in some situations -- needs more investigation - if (Debug.getProperty("jogl.drihack.disable", true) != null) { + static { + // Allow manual overriding for now as a workaround for + // problems seen in some situations -- needs more investigation + if (Debug.getProperty("jogl.drihack.disable", true) != null) { driHackNeeded = false; - } - return null; + } else { + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + String os = Platform.getOS().toLowerCase(); + // Do DRI hack on all Linux distributions for best robustness + driHackNeeded = os.startsWith("linux") + || new File("/usr/lib/dri").exists() + || new File("/usr/X11R6/lib/modules/dri").exists(); + return null; + } + }); } - }); + } + + public static void begin() { if (driHackNeeded) { if (DEBUG) { @@ -106,12 +111,17 @@ public class DRIHack { // Try a few different variants for best robustness // In theory probably only the first is necessary oglLib = NativeLibrary.open("libGL.so.1", null); - if (DEBUG && oglLib != null) System.err.println(" Found libGL.so.1"); + if (DEBUG && oglLib != null) { + System.err.println(" Found libGL.so.1"); + } if (oglLib == null) { oglLib = NativeLibrary.open("/usr/lib/libGL.so.1", null); - if (DEBUG && oglLib != null) System.err.println(" Found /usr/lib/libGL.so.1"); + if (DEBUG && oglLib != null) { + System.err.println(" Found /usr/lib/libGL.so.1"); + } } } + } public static void end() { -- cgit v1.2.3