aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/games/jogl/impl/x11/X11GLDrawableFactory.java
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2005-07-19 01:53:36 +0000
committerKenneth Russel <[email protected]>2005-07-19 01:53:36 +0000
commit74adb7cc4ba59369964b562e3c84988f63025296 (patch)
tree0a850c1110afa161eeadb930c4035eb310b79f84 /src/net/java/games/jogl/impl/x11/X11GLDrawableFactory.java
parentb01ac27a7d6ae4863490537e1ba8749795cd84de (diff)
Added workaround for problem loading JAWT library on X11 platforms
before the AWT toolkit had been loaded. Added check for jogl.gljpanel.nosw system property to diagnose problems with pbuffer support. Fixed bootstrapping problem with GLX where its function pointer table needed to be initialized before the first OpenGL context was created in the case where a pbuffer was the first thing created. Moved helper functions for resetting proc address table and dynamic function lookup to GLDrawableFactoryImpl from GLContextImpl. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JSR-231@331 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net/java/games/jogl/impl/x11/X11GLDrawableFactory.java')
-rwxr-xr-xsrc/net/java/games/jogl/impl/x11/X11GLDrawableFactory.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/net/java/games/jogl/impl/x11/X11GLDrawableFactory.java b/src/net/java/games/jogl/impl/x11/X11GLDrawableFactory.java
index 2db572f6d..49db6230c 100755
--- a/src/net/java/games/jogl/impl/x11/X11GLDrawableFactory.java
+++ b/src/net/java/games/jogl/impl/x11/X11GLDrawableFactory.java
@@ -44,6 +44,7 @@ import java.awt.EventQueue;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.lang.reflect.InvocationTargetException;
+import java.security.*;
import java.util.ArrayList;
import java.util.List;
import net.java.games.jogl.*;
@@ -52,8 +53,28 @@ import net.java.games.jogl.impl.*;
public class X11GLDrawableFactory extends GLDrawableFactoryImpl {
private static final boolean DEBUG = Debug.debug("X11GLDrawableFactory");
+ // There is currently a bug on Linux/AMD64 distributions in glXGetProcAddressARB
+ private static boolean isLinuxAMD64;
+
static {
NativeLibLoader.load();
+
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ String os = System.getProperty("os.name").toLowerCase();
+ String arch = System.getProperty("os.arch").toLowerCase();
+ if (os.startsWith("linux") && arch.equals("amd64")) {
+ isLinuxAMD64 = true;
+ }
+ return null;
+ }
+ });
+ }
+
+ public X11GLDrawableFactory() {
+ // Must initialize GLX support eagerly in case a pbuffer is the
+ // first thing instantiated
+ resetProcAddressTable(GLX.getGLXProcAddressTable());
}
private static final int MAX_ATTRIBS = 128;
@@ -209,6 +230,18 @@ public class X11GLDrawableFactory extends GLDrawableFactoryImpl {
return (GLPbuffer) returnList.get(0);
}
+ public long dynamicLookupFunction(String glFuncName) {
+ long res = 0;
+ if (!isLinuxAMD64) {
+ res = GLX.glXGetProcAddressARB(glFuncName);
+ }
+ if (res == 0) {
+ // GLU routines aren't known to the OpenGL function lookup
+ res = GLX.dlsym(glFuncName);
+ }
+ return res;
+ }
+
public static GLCapabilities xvi2GLCapabilities(long display, XVisualInfo info) {
int[] tmp = new int[1];
int val = glXGetConfig(display, info, GLX.GLX_USE_GL, tmp, 0);