Forráskód Böngészése

Updated lwjgl3 module to use LWJGL 3.0.0b #35 which is the current stable build.

Daniel Johansson 10 éve
szülő
commit
5e8f5e6a1f

+ 24 - 9
jme3-desktop/src/main/java/com/jme3/system/NativeLibraryLoader.java

@@ -144,8 +144,22 @@ public final class NativeLibraryLoader {
         registerNativeLibrary("lwjgl3", Platform.Linux64, "native/linux/liblwjgl.so");
         registerNativeLibrary("lwjgl3", Platform.MacOSX32, "native/macosx/liblwjgl.dylib");
         registerNativeLibrary("lwjgl3", Platform.MacOSX64, "native/macosx/liblwjgl.dylib");
-        //registerNativeLibrary("lwjgl3", Platform.Windows32, "native/windows/jemalloc32.dll");     // These are introduced in LWJGL 3.0.0b
-        //registerNativeLibrary("lwjgl3", Platform.Windows64, "native/windows/jemalloc.dll");       // These are introduced in LWJGL 3.0.0b
+
+        // GLFW for LWJGL 3.x
+        registerNativeLibrary("glfw-lwjgl3", Platform.Windows32, "native/windows/glfw32.dll");
+        registerNativeLibrary("glfw-lwjgl3", Platform.Windows64, "native/windows/glfw.dll");
+        registerNativeLibrary("glfw-lwjgl3", Platform.Linux32, "native/linux/libglfw32.so");
+        registerNativeLibrary("glfw-lwjgl3", Platform.Linux64, "native/linux/libglfw.dll");
+        registerNativeLibrary("glfw-lwjgl3", Platform.MacOSX32, "native/macosx/libglfw.dylib");
+        registerNativeLibrary("glfw-lwjgl3", Platform.MacOSX64, "native/macosx/libglfw.dylib");
+
+        // jemalloc for LWJGL 3.x
+        registerNativeLibrary("jemalloc-lwjgl3", Platform.Windows32, "native/windows/jemalloc32.dll");
+        registerNativeLibrary("jemalloc-lwjgl3", Platform.Windows64, "native/windows/jemalloc.dll");
+        registerNativeLibrary("jemalloc-lwjgl3", Platform.Linux32, "native/linux/libjemalloc32.so");
+        registerNativeLibrary("jemalloc-lwjgl3", Platform.Linux64, "native/linux/libjemalloc.so");
+        registerNativeLibrary("jemalloc-lwjgl3", Platform.MacOSX32, "native/macosx/libjemalloc.dylib");
+        registerNativeLibrary("jemalloc-lwjgl3", Platform.MacOSX64, "native/macosx/libjemalloc.dylib");
 
         // OpenAL for LWJGL 3.x
         // For OSX: Need to add lib prefix when extracting
@@ -475,7 +489,7 @@ public final class NativeLibraryLoader {
         if (url == null) {
             return;
         }
-        
+
         String loadedAsFileName;
         if (library.getExtractedAsName() != null) {
             loadedAsFileName = library.getExtractedAsName();
@@ -522,7 +536,7 @@ public final class NativeLibraryLoader {
             throw new UnsupportedOperationException("JVM is running under "
                     + "reduced permissions. Cannot load native libraries.");
         }
-        
+
         Platform platform = JmeSystem.getPlatform();
         NativeLibrary library = nativeLibraryMap.get(new NativeLibrary.Key(name, platform));
         
@@ -540,27 +554,28 @@ public final class NativeLibraryLoader {
             }
         }
         
-        String pathInJar = library.getPathInNativesJar();
-        
+        final String pathInJar = library.getPathInNativesJar();
+
         if (pathInJar == null) {
             // This platform does not require the native library to be loaded.
             return;
         }
         
-        String fileNameInJar;
+        final String fileNameInJar;
+
         if (pathInJar.contains("/")) {
             fileNameInJar = pathInJar.substring(pathInJar.lastIndexOf("/") + 1);
         } else {
             fileNameInJar = pathInJar;
         }
-        
+
         URL url = Thread.currentThread().getContextClassLoader().getResource(pathInJar);
         
         if (url == null) {
             // Try the root of the classpath as well.
             url = Thread.currentThread().getContextClassLoader().getResource(fileNameInJar);
         }
-        
+
         if (url == null) {
             // Attempt to load it as a system library.
             String unmappedName = unmapLibraryName(fileNameInJar);

+ 1 - 4
jme3-lwjgl3/build.gradle

@@ -11,8 +11,5 @@ repositories {
 dependencies {
     compile project(':jme3-core')
     compile project(':jme3-desktop')
-    compile 'org.lwjgl:lwjgl:3.0.0a'
-    compile group: 'org.lwjgl', name: 'lwjgl-platform', version: '3.0.0a', classifier: 'natives-windows'
-    compile group: 'org.lwjgl', name: 'lwjgl-platform', version: '3.0.0a', classifier: 'natives-linux'
-    compile group: 'org.lwjgl', name: 'lwjgl-platform', version: '3.0.0a', classifier: 'natives-osx'
+    compile files('lib/lwjgl-3.0.0b-35.jar', 'lib/lwjgl-3.0.0b-35-natives.jar')
 }

BIN
jme3-lwjgl3/lib/lwjgl-3.0.0b-35-natives.jar


BIN
jme3-lwjgl3/lib/lwjgl-3.0.0b-35.jar


+ 8 - 1
jme3-lwjgl3/src/main/java/com/jme3/audio/lwjgl/LwjglALC.java

@@ -34,6 +34,7 @@ package com.jme3.audio.lwjgl;
 import com.jme3.audio.openal.ALC;
 import org.lwjgl.openal.ALC10;
 import org.lwjgl.openal.ALContext;
+import org.lwjgl.openal.ALDevice;
 
 import java.nio.IntBuffer;
 
@@ -42,16 +43,22 @@ import static org.lwjgl.openal.ALC10.alcGetCurrentContext;
 
 public class LwjglALC implements ALC {
 
+    private ALDevice device;
     private ALContext context;
 
     public void createALC() {
-        context = ALContext.create();
+        device = ALDevice.create();
+        context = ALContext.create(device);
     }
 
     public void destroyALC() {
         if (context != null) {
             context.destroy();
         }
+
+        if (device != null) {
+            device.destroy();
+        }
     }
 
     public boolean isCreated() {

+ 7 - 4
jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java

@@ -42,11 +42,13 @@ import com.jme3.renderer.lwjgl.LwjglGLExt;
 import com.jme3.renderer.lwjgl.LwjglGLFboEXT;
 import com.jme3.renderer.lwjgl.LwjglGLFboGL3;
 import com.jme3.renderer.opengl.*;
-import com.jme3.renderer.opengl.GL;
 import com.jme3.system.*;
 import org.lwjgl.Sys;
 import org.lwjgl.glfw.GLFW;
-import org.lwjgl.opengl.*;
+import org.lwjgl.opengl.ARBDebugOutput;
+import org.lwjgl.opengl.ARBFramebufferObject;
+import org.lwjgl.opengl.EXTFramebufferMultisample;
+import org.lwjgl.opengl.GLCapabilities;
 
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.logging.Level;
@@ -111,6 +113,8 @@ public abstract class LwjglContext implements JmeContext {
             NativeLibraryLoader.loadNativeLibrary("bulletjme", true);
         }
 
+        NativeLibraryLoader.loadNativeLibrary("glfw-lwjgl3", true);
+        NativeLibraryLoader.loadNativeLibrary("jemalloc-lwjgl3", true);
         NativeLibraryLoader.loadNativeLibrary("lwjgl3", true);
     }
 
@@ -132,8 +136,7 @@ public abstract class LwjglContext implements JmeContext {
     }
 
     protected void initContextFirstTime() {
-        GLContext.createFromCurrent();
-        final ContextCapabilities capabilities = createCapabilities(settings.getRenderer().equals(AppSettings.LWJGL_OPENGL3));
+        final GLCapabilities capabilities = createCapabilities(settings.getRenderer().equals(AppSettings.LWJGL_OPENGL3));
 
         if (!capabilities.OpenGL20) {
             throw new RendererException("OpenGL 2.0 or higher is required for jMonkeyEngine");