From b02adebb3213e19aecfe84e6966e52976e5c09cf Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 25 Jun 2008 05:50:55 +0000 Subject: Native Compilation: Partitioning and X11 clean git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1680 232f8b59-042b-4e1e-8c03-345bb8c30851 --- .../com/sun/opengl/impl/NativeLibLoader.java | 31 ++++++++++++++++++++-- .../sun/opengl/impl/egl/EGLDrawableFactory.java | 13 ++++++--- .../impl/macosx/cgl/MacOSXCGLDrawableFactory.java | 2 +- .../windows/wgl/WindowsWGLDrawableFactory.java | 2 +- .../opengl/impl/x11/glx/X11GLXDrawableFactory.java | 2 +- .../impl/x11/glx/awt/X11AWTGLXDrawableFactory.java | 2 +- 6 files changed, 42 insertions(+), 10 deletions(-) (limited to 'src/classes/com/sun/opengl') diff --git a/src/classes/com/sun/opengl/impl/NativeLibLoader.java b/src/classes/com/sun/opengl/impl/NativeLibLoader.java index 4fe59b003..6a1270ac2 100644 --- a/src/classes/com/sun/opengl/impl/NativeLibLoader.java +++ b/src/classes/com/sun/opengl/impl/NativeLibLoader.java @@ -106,10 +106,37 @@ public class NativeLibLoader { } } - public static void loadCore() { + public static void loadNEWT() { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { - loadLibrary("jogl", null, false, false); + loadLibrary("newt", null, false, false); + return null; + } + }); + } + + public static void loadGL2() { + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + loadLibrary("jogl_gl2", null, false, false); + return null; + } + }); + } + + public static void loadES2() { + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + loadLibrary("jogl_es2", null, false, false); + return null; + } + }); + } + + public static void loadES1() { + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + loadLibrary("jogl_es1", null, false, false); return null; } }); diff --git a/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java index a796aa01c..9ba2a0c40 100755 --- a/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java @@ -41,9 +41,6 @@ import com.sun.opengl.impl.*; import com.sun.gluegen.runtime.NativeLibrary; public class EGLDrawableFactory extends GLDrawableFactoryImpl { - static { - NativeLibLoader.loadCore(); - } // We need more than one of these on certain devices (the NVidia APX 2500 in particular) private List/**/ glesLibraries; @@ -70,9 +67,11 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { if (GLProfile.isGLES2()) { glesLibNames.add("libGLESv2_CM"); glesLibNames.add("GLESv2_CM"); - } else { + } else if (GLProfile.isGLES1()) { glesLibNames.add("libGLESv1_CM"); glesLibNames.add("GLESv1_CM"); + } else { + throw new GLException("Invalid GL Profile for EGL: "+GLProfile.getProfile()); } ClassLoader loader = getClass().getClassLoader(); @@ -94,6 +93,12 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { libs.add(eglLib); } glesLibraries = libs; + + if (GLProfile.isGLES2()) { + NativeLibLoader.loadES2(); + } else if (GLProfile.isGLES1()) { + NativeLibLoader.loadES1(); + } } public AbstractGraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, diff --git a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java index ae108121c..04c9df103 100644 --- a/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java @@ -47,7 +47,7 @@ import com.sun.opengl.impl.*; public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { static { - NativeLibLoader.loadCore(); + NativeLibLoader.loadGL2(); } public MacOSXCGLDrawableFactory() { diff --git a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java index fd4e5620c..4e162f57d 100644 --- a/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java @@ -54,7 +54,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { private long hglu32; static { - NativeLibLoader.loadCore(); + NativeLibLoader.loadGL2(); } public WindowsWGLDrawableFactory() { diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java index ed48f9186..dd5e69dcd 100644 --- a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java @@ -88,7 +88,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { // See DRIHack.java for an explanation of why this is necessary DRIHack.begin(); - com.sun.opengl.impl.NativeLibLoader.loadCore(); + com.sun.opengl.impl.NativeLibLoader.loadGL2(); DRIHack.end(); } diff --git a/src/classes/com/sun/opengl/impl/x11/glx/awt/X11AWTGLXDrawableFactory.java b/src/classes/com/sun/opengl/impl/x11/glx/awt/X11AWTGLXDrawableFactory.java index d969f18aa..a6f545b87 100644 --- a/src/classes/com/sun/opengl/impl/x11/glx/awt/X11AWTGLXDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/x11/glx/awt/X11AWTGLXDrawableFactory.java @@ -58,7 +58,7 @@ public class X11AWTGLXDrawableFactory extends X11GLXDrawableFactory { // See DRIHack.java for an explanation of why this is necessary DRIHack.begin(); - com.sun.opengl.impl.NativeLibLoader.loadCore(); + com.sun.opengl.impl.NativeLibLoader.loadGL2(); DRIHack.end(); } -- cgit v1.2.3