Conforming to LWJGL3 library

fix-456
Julien Seinturier 8 years ago
parent 59d41c865b
commit 2af2b121ec
  1. 1
      jme3-vr/build.gradle
  2. 4
      jme3-vr/src/main/java/com/jme3/input/lwjgl/GlfwKeyInputVR.java
  3. 10
      jme3-vr/src/main/java/com/jme3/input/lwjgl/GlfwMouseInputVR.java
  4. 2
      jme3-vr/src/main/java/com/jme3/input/vr/OSVR.java
  5. 4
      jme3-vr/src/main/java/com/jme3/system/lwjgl/LwjglContextVR.java
  6. 6
      jme3-vr/src/main/java/com/jme3/system/lwjgl/LwjglDisplayVR.java
  7. 30
      jme3-vr/src/main/java/com/jme3/system/lwjgl/LwjglWindowVR.java

@ -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'
}

@ -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.");
}

@ -242,14 +242,10 @@ public class GlfwMouseInputVR implements MouseInput {
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);

@ -175,7 +175,7 @@ public class OSVR implements VRAPI {
* @return <code>true</code> if the context is successfully shared and <code>false</code> 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 {

@ -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);
}

@ -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;
}
}

@ -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);
}
}

Loading…
Cancel
Save