Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[versions]

checkstyle = "9.3"
lwjgl3 = "3.3.4"
lwjgl3 = "3.3.6"
nifty = "1.4.3"

[libraries]
Expand Down
10 changes: 5 additions & 5 deletions jme3-vr/src/main/java/com/jme3/input/vr/osvr/OSVR.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.sun.jna.Pointer;
import com.sun.jna.ptr.PointerByReference;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.logging.Logger;

/**
Expand Down Expand Up @@ -78,6 +79,7 @@ public class OSVR implements VRAPI {
*/
public static byte[] OpenGLString = { 'O', 'p', 'e', 'n', 'G', 'L', (byte)0 };

private final IntBuffer lastError = IntBuffer.allocate(2);
private final Matrix4f[] eyeMatrix = new Matrix4f[2];

private PointerByReference grabRM;
Expand Down Expand Up @@ -180,7 +182,7 @@ public boolean initialize() {
*/
public void grabGLFWContext() {
// get current context
wglGLFW = org.lwjgl.opengl.WGL.wglGetCurrentContext();
wglGLFW = org.lwjgl.opengl.WGL.wglGetCurrentContext(lastError);
glfwContext = org.lwjgl.glfw.GLFW.glfwGetCurrentContext();
}

Expand All @@ -189,7 +191,7 @@ public void grabGLFWContext() {
* @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)) {
if (org.lwjgl.opengl.WGL.wglShareLists(lastError, wglRM, wglGLFW)) {
System.out.println("Context sharing success!");
return true;
} else {
Expand All @@ -216,7 +218,7 @@ public boolean initVRCompositor(boolean allowed) {
openResults.setAutoSynch(false);
retval = OsvrRenderManagerOpenGLLibrary.osvrRenderManagerOpenDisplayOpenGL(renderManager, openResults);
if( retval == 0 ) {
wglRM = org.lwjgl.opengl.WGL.wglGetCurrentContext();
wglRM = org.lwjgl.opengl.WGL.wglGetCurrentContext(lastError);
renderManagerContext = org.lwjgl.glfw.GLFW.glfwGetCurrentContext();
shareContext();
OsvrClientKitLibrary.osvrClientUpdate(context);
Expand Down Expand Up @@ -298,7 +300,6 @@ public void reset() {
// may need to take current position and negate it from future values
}

@Override
public void getRenderSize(Vector2f store) {
if( eyeLeftInfo == null || eyeLeftInfo.viewport.width == 0.0 ) {
store.x = 1280f; store.y = 720f;
Expand Down Expand Up @@ -345,7 +346,6 @@ public Vector3f getPosition() {
return storePos;
}

@Override
public void getPositionAndOrientation(Vector3f storePos, Quaternion storeRot) {
storePos.x = (float)-hmdPose.translation.data[0];
storePos.y = (float)hmdPose.translation.data[1];
Expand Down