Fix mirror window displaying blank for Oculus Rift

empirephoenix-patch-1
Campbell Suter 7 years ago
parent 9747c556ff
commit 7b30f69c2a
No known key found for this signature in database
GPG Key ID: 754A66CCF3F73C0F
  1. 7
      jme3-vr/src/main/java/com/jme3/app/VRAppState.java
  2. 10
      jme3-vr/src/main/java/com/jme3/util/VRViewManagerOculus.java

@ -34,6 +34,7 @@ package com.jme3.app;
import com.jme3.app.Application;
import com.jme3.app.state.AbstractAppState;
import com.jme3.app.state.AppStateManager;
import com.jme3.input.vr.OculusVR;
import com.jme3.input.vr.VRAPI;
import com.jme3.input.vr.VRInputAPI;
import com.jme3.math.ColorRGBA;
@ -608,7 +609,11 @@ public class VRAppState extends AbstractAppState {
settings.setFrequency(environment.getVRHardware().getDisplayFrequency());
settings.setFullscreen(false);
settings.setVSync(false); // stop vsyncing on primary monitor!
settings.setSwapBuffers(environment.isSwapBuffers());
// TODO: Is this preventing desktop display on _ALL_ HMDs?
if(!(getVRHardware() instanceof OculusVR)) {
settings.setSwapBuffers(environment.isSwapBuffers());
}
}
// Updating application settings

@ -135,9 +135,19 @@ public class VRViewManagerOculus extends AbstractVRViewManager {
finalRotation.multLocal(hmdRot);
}
// Update both eye cameras
finalizeCamera(hardware.getHMDVectorPoseLeftEye(), objPos, leftCamera);
finalizeCamera(hardware.getHMDVectorPoseRightEye(), objPos, rightCamera);
// Update the main camera, so it shows the same basic view the HMD is getting
// TODO: Do this in VRAppState, so it works on all HMDs.
// I only have a Rift, so I can't test it on anything else.
if(!environment.isInstanceRendering()) { // We use the app camera as the left camera here
// TODO: Double up on rendering and use one eye, to reduce GPU load rendering the scene again.
// TODO: Snip at the image to remove the distorted corners from a very high FOV.
finalizeCamera(Vector3f.ZERO, objPos, environment.getApplication().getCamera());
}
if (environment.hasTraditionalGUIOverlay()) {
// update the mouse?
environment.getVRMouseManager().update(tpf);

Loading…
Cancel
Save