diff options
author | Kenneth Russel <[email protected]> | 2006-02-10 20:06:04 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2006-02-10 20:06:04 +0000 |
commit | 4b14f14cbb84c3d60d3fb501d78873c574eec6bd (patch) | |
tree | 2bac953157778f18e0eff06c4c01fe08e55d9076 /src/classes/com/sun/opengl | |
parent | c6ed1767abe191648219a403828ecf32ad5ad25e (diff) |
Made loading of GLU library lazier, partially in the hope that this
may address problems on certain Linux distributions where for some
reason we're falling back to software rendering with Mesa
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@595 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/com/sun/opengl')
4 files changed, 25 insertions, 6 deletions
diff --git a/src/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java b/src/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java index 45a875361..3f9580cc7 100644 --- a/src/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java +++ b/src/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java @@ -75,6 +75,11 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory implements return (GLDrawableFactoryImpl) getFactory(); } + // Helper function for more lazily loading the GLU library; + // apparently can't use System.loadLibrary on UNIX because it uses + // RTLD_LOCAL and we need to call dlsym(RTLD_DEFAULT) + public abstract void loadGLULibrary(); + //---------------------------------------------------------------------- // Gamma adjustment support // Thanks to the LWJGL team for illustrating how to make these diff --git a/src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawableFactory.java index fbc52e850..facf9e648 100644 --- a/src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/macosx/MacOSXGLDrawableFactory.java @@ -118,6 +118,11 @@ public class MacOSXGLDrawableFactory extends GLDrawableFactoryImpl { throw new GLException("Not yet implemented"); } + public void loadGLULibrary() { + // Nothing to do; already loaded by native code; not much point in + // making it lazier on this platform + } + public long dynamicLookupFunction(String glFuncName) { return CGL.getProcAddress(glFuncName); } diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawableFactory.java index eab068bb4..94fd0eb1e 100644 --- a/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawableFactory.java @@ -173,17 +173,22 @@ public class WindowsGLDrawableFactory extends GLDrawableFactoryImpl { return new WindowsExternalGLDrawable(); } + public void loadGLULibrary() { + if (hglu32 == 0) { + hglu32 = WGL.LoadLibraryA("GLU32"); + if (hglu32 == 0) { + throw new GLException("Error loading GLU32.DLL"); + } + } + } + public long dynamicLookupFunction(String glFuncName) { long res = WGL.wglGetProcAddress(glFuncName); if (res == 0) { // GLU routines aren't known to the OpenGL function lookup - if (hglu32 == 0) { - hglu32 = WGL.LoadLibraryA("GLU32"); - if (hglu32 == 0) { - throw new GLException("Error loading GLU32.DLL"); - } + if (hglu32 != 0) { + res = WGL.GetProcAddress(hglu32, glFuncName); } - res = WGL.GetProcAddress(hglu32, glFuncName); } return res; } diff --git a/src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java b/src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java index 6d6f02441..248371c37 100644 --- a/src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java @@ -261,6 +261,10 @@ public class X11GLDrawableFactory extends GLDrawableFactoryImpl { return new X11ExternalGLDrawable(); } + public void loadGLULibrary() { + GLX.dlopen("/usr/lib/libGLU.so"); + } + public long dynamicLookupFunction(String glFuncName) { long res = 0; if (!isLinuxAMD64) { |