summaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/opengl/util/JOGLAppletLauncher.java
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2006-02-16 02:49:30 +0000
committerKenneth Russel <[email protected]>2006-02-16 02:49:30 +0000
commit945e2ae3d234815b43f83049c9d597cb61585797 (patch)
treee5967c06c09bddd9068e0807573da34d6dfa2fa0 /src/classes/com/sun/opengl/util/JOGLAppletLauncher.java
parentf50877b19f5a3cb4deb1b26395ce357f3ebfd3f0 (diff)
Fixed problems with lack of hardware acceleration on Linux
distributions using DRI drivers. Hacked around limitations of the current DRI implementation by manually dlopen'ing libGL.so.1; avoids changing glue code generation for core OpenGL 1.1 routines which do not otherwise need to be called through function pointers on any platform. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@614 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/com/sun/opengl/util/JOGLAppletLauncher.java')
-rwxr-xr-xsrc/classes/com/sun/opengl/util/JOGLAppletLauncher.java34
1 files changed, 31 insertions, 3 deletions
diff --git a/src/classes/com/sun/opengl/util/JOGLAppletLauncher.java b/src/classes/com/sun/opengl/util/JOGLAppletLauncher.java
index 7a9f8ab74..6db8d39be 100755
--- a/src/classes/com/sun/opengl/util/JOGLAppletLauncher.java
+++ b/src/classes/com/sun/opengl/util/JOGLAppletLauncher.java
@@ -181,6 +181,10 @@ public class JOGLAppletLauncher extends Applet {
// The signatures of these native libraries are checked before
// installing them.
private String[] nativeLibNames;
+ // Whether the "DRI hack" native library is present and whether we
+ // therefore might need to run the DRIHack during loading of the
+ // native libraries
+ private boolean driHackPresent;
/** The applet we have to start */
private Applet subApplet;
@@ -524,6 +528,9 @@ public class JOGLAppletLauncher extends Applet {
JarEntry entry = (JarEntry) e.nextElement();
if (nativeLibInfo.matchesNativeLib(entry.getName())) {
list.add(entry.getName());
+ if (entry.getName().indexOf("jogl_drihack") >= 0) {
+ driHackPresent = true;
+ }
}
}
if (list.isEmpty()) {
@@ -615,9 +622,33 @@ public class JOGLAppletLauncher extends Applet {
public void run() {
displayMessage("Loading native libraries");
+ // disable JOGL loading from elsewhere
+ com.sun.opengl.impl.NativeLibLoader.disableLoading();
+
+ Class driHackClass = null;
+ if (driHackPresent) {
+ // Load DRI hack library and run the DRI hack itself
+ loadLibrary(nativeLibDir, "jogl_drihack");
+ try {
+ driHackClass = Class.forName("com.sun.opengl.impl.x11.DRIHack");
+ driHackClass.getMethod("begin", new Class[] {}).invoke(null, new Object[] {});
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
// Load core JOGL native library
loadLibrary(nativeLibDir, "jogl");
+ if (driHackPresent) {
+ // End DRI hack
+ try {
+ driHackClass.getMethod("end", new Class[] {}).invoke(null, new Object[] {});
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
if (!nativeLibInfo.isMacOS()) { // borrowed from NativeLibLoader
// Must pre-load JAWT on all non-Mac platforms to
// ensure references from jogl_awt shared object
@@ -638,9 +669,6 @@ public class JOGLAppletLauncher extends Applet {
// Load AWT-specific native code
loadLibrary(nativeLibDir, "jogl_awt");
- // disable JOGL loading from elsewhere
- com.sun.opengl.impl.NativeLibLoader.disableLoading();
-
displayMessage("Starting applet " + subAppletDisplayName);
// start the subapplet