aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/games/jogl/impl/x11/X11GLDrawableFactory.java
diff options
context:
space:
mode:
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);