diff --git a/jme3-vr/build.gradle b/jme3-vr/build.gradle index 796d3eb9e..ec1ec8fed 100644 --- a/jme3-vr/build.gradle +++ b/jme3-vr/build.gradle @@ -13,4 +13,5 @@ dependencies { // https://mvnrepository.com/artifact/net.java.dev.jna/jna compile group: 'net.java.dev.jna', name: 'jna', version: '4.3.0' + compile 'com.nativelibs4java:jnaerator-runtime:0.12' } \ No newline at end of file diff --git a/jme3-vr/src/main/java/com/jme3/input/lwjgl/GlfwKeyInputVR.java b/jme3-vr/src/main/java/com/jme3/input/lwjgl/GlfwKeyInputVR.java index 900d8b676..c670ccd3e 100644 --- a/jme3-vr/src/main/java/com/jme3/input/lwjgl/GlfwKeyInputVR.java +++ b/jme3-vr/src/main/java/com/jme3/input/lwjgl/GlfwKeyInputVR.java @@ -121,9 +121,7 @@ public class GlfwKeyInputVR implements KeyInput { return; } - //FIXME: Needs LWJGL 3.1.0 - //keyCallback.free(); - keyCallback.release(); + keyCallback.free(); logger.fine("Keyboard destroyed."); } diff --git a/jme3-vr/src/main/java/com/jme3/input/lwjgl/GlfwMouseInputVR.java b/jme3-vr/src/main/java/com/jme3/input/lwjgl/GlfwMouseInputVR.java index 22759db29..22ac434c7 100644 --- a/jme3-vr/src/main/java/com/jme3/input/lwjgl/GlfwMouseInputVR.java +++ b/jme3-vr/src/main/java/com/jme3/input/lwjgl/GlfwMouseInputVR.java @@ -241,15 +241,11 @@ public class GlfwMouseInputVR implements MouseInput { if (!context.isRenderable()) { return; } - - cursorPosCallback.release(); - scrollCallback.release(); - mouseButtonCallback.release(); //FIXME: Needs LWJGL 3.1.0 - //cursorPosCallback.free(); - //scrollCallback.free(); - //mouseButtonCallback.free(); + cursorPosCallback.free(); + scrollCallback.free(); + mouseButtonCallback.free(); for (long glfwCursor : jmeToGlfwCursorMap.values()) { glfwDestroyCursor(glfwCursor); diff --git a/jme3-vr/src/main/java/com/jme3/input/vr/OSVR.java b/jme3-vr/src/main/java/com/jme3/input/vr/OSVR.java index f5305a64d..72e1cffab 100644 --- a/jme3-vr/src/main/java/com/jme3/input/vr/OSVR.java +++ b/jme3-vr/src/main/java/com/jme3/input/vr/OSVR.java @@ -175,7 +175,7 @@ public class OSVR implements VRAPI { * @return true if the context is successfully shared and false otherwise. */ public boolean shareContext() { - if( org.lwjgl.opengl.WGL.wglShareLists(wglRM, wglGLFW) == 0) { + if( org.lwjgl.opengl.WGL.wglShareLists(wglRM, wglGLFW)) { System.out.println("Context sharing success!"); return true; } else { diff --git a/jme3-vr/src/main/java/com/jme3/system/lwjgl/LwjglContextVR.java b/jme3-vr/src/main/java/com/jme3/system/lwjgl/LwjglContextVR.java index 973982594..3efa0d150 100644 --- a/jme3-vr/src/main/java/com/jme3/system/lwjgl/LwjglContextVR.java +++ b/jme3-vr/src/main/java/com/jme3/system/lwjgl/LwjglContextVR.java @@ -93,9 +93,9 @@ public abstract class LwjglContextVR implements JmeContext { logger.log(Level.SEVERE, "glfwExtensionSupported(\"GL_ARB_framebuffer_object\"): "+GLFW.glfwExtensionSupported("GL_ARB_framebuffer_object")); logger.log(Level.SEVERE, "glfwExtensionSupported(\"GL_EXT_framebuffer_multisample\"): "+GLFW.glfwExtensionSupported("GL_ARB_framebuffer_object")); - if (GLFW.glfwExtensionSupported("GL_ARB_framebuffer_object") != 0) { + if (GLFW.glfwExtensionSupported("GL_ARB_framebuffer_object")) { return glGetInteger(ARBFramebufferObject.GL_MAX_SAMPLES); - } else if (GLFW.glfwExtensionSupported("GL_EXT_framebuffer_multisample") != 0) { + } else if (GLFW.glfwExtensionSupported("GL_EXT_framebuffer_multisample")) { return glGetInteger(EXTFramebufferMultisample.GL_MAX_SAMPLES_EXT); } diff --git a/jme3-vr/src/main/java/com/jme3/system/lwjgl/LwjglDisplayVR.java b/jme3-vr/src/main/java/com/jme3/system/lwjgl/LwjglDisplayVR.java index 03ce516af..8915940f7 100644 --- a/jme3-vr/src/main/java/com/jme3/system/lwjgl/LwjglDisplayVR.java +++ b/jme3-vr/src/main/java/com/jme3/system/lwjgl/LwjglDisplayVR.java @@ -31,6 +31,7 @@ */ package com.jme3.system.lwjgl; +import com.jme3.opencl.Context; /** * A VR oriented LWJGL display. @@ -47,5 +48,10 @@ public class LwjglDisplayVR extends LwjglWindowVR { super(Type.Display); } + @Override + public Context getOpenCLContext() { + return null; + } + } diff --git a/jme3-vr/src/main/java/com/jme3/system/lwjgl/LwjglWindowVR.java b/jme3-vr/src/main/java/com/jme3/system/lwjgl/LwjglWindowVR.java index 15ba921f2..4c8b91624 100644 --- a/jme3-vr/src/main/java/com/jme3/system/lwjgl/LwjglWindowVR.java +++ b/jme3-vr/src/main/java/com/jme3/system/lwjgl/LwjglWindowVR.java @@ -70,7 +70,7 @@ public abstract class LwjglWindowVR extends LwjglContextVR implements Runnable { protected AtomicBoolean needClose = new AtomicBoolean(false); protected final AtomicBoolean needRestart = new AtomicBoolean(false); - protected int wasActive = GL.GL_FALSE; + protected boolean wasActive = false; protected boolean autoFlush = true; protected boolean allowSwapBuffers = false; private long window = NULL; @@ -138,7 +138,7 @@ public abstract class LwjglWindowVR extends LwjglContextVR implements Runnable { } }); - if ( glfwInit() == GLFW_FALSE ) { + if ( glfwInit() == false ) { throw new IllegalStateException("Unable to initialize GLFW"); } @@ -165,7 +165,7 @@ public abstract class LwjglWindowVR extends LwjglContextVR implements Runnable { glfwWindowHint(GLFW_VISIBLE, GL_FALSE); glfwWindowHint(GLFW_RESIZABLE, settings.isResizable() ? GLFW_TRUE : GLFW_FALSE); - glfwWindowHint(GLFW_DOUBLE_BUFFER, GLFW_TRUE); + glfwWindowHint(GLFW_DOUBLEBUFFER, GLFW_TRUE); glfwWindowHint(GLFW_DEPTH_BITS, settings.getDepthBits()); glfwWindowHint(GLFW_STENCIL_BITS, settings.getStencilBits()); glfwWindowHint(GLFW_SAMPLES, settings.getSamples()); @@ -206,15 +206,15 @@ public abstract class LwjglWindowVR extends LwjglContextVR implements Runnable { glfwSetWindowFocusCallback(window, windowFocusCallback = new GLFWWindowFocusCallback() { @Override - public void invoke(long window, int focused) { + public void invoke(long window, boolean focused) { if (wasActive != focused) { - if (wasActive == GL11.GL_FALSE) { + if (wasActive == false) { listener.gainFocus(); timer.reset(); - wasActive = GL11.GL_TRUE; + wasActive = true; } else { listener.loseFocus(); - wasActive = GL11.GL_FALSE; + wasActive = false; } @@ -273,28 +273,20 @@ public abstract class LwjglWindowVR extends LwjglContextVR implements Runnable { } if (errorCallback != null) { - - //FIXME: Needs LWJGL 3.1.0 - //errorCallback.free(); - errorCallback.release(); - + errorCallback.free(); errorCallback = null; } if (windowSizeCallback != null) { - - //FIXME: Needs LWJGL 3.1.0 - //windowSizeCallback.free(); - windowSizeCallback.release(); + + windowSizeCallback.free(); windowSizeCallback = null; } if (windowFocusCallback != null) { - //FIXME: Needs LWJGL 3.1.0 - //windowFocusCallback.free(); - windowFocusCallback.release(); + windowFocusCallback.free(); windowFocusCallback = null; } @@ -479,7 +471,7 @@ public abstract class LwjglWindowVR extends LwjglContextVR implements Runnable { break; } - if (glfwWindowShouldClose(window) == GLFW_TRUE) { + if (glfwWindowShouldClose(window) == true) { listener.requestClose(false); } }