diff options
Diffstat (limited to 'src/classes/com')
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) { |