Fix mirror window displaying blank for Oculus Rift

This commit is contained in:
Campbell Suter 2017-10-05 11:56:00 +13:00
parent 9747c556ff
commit 7b30f69c2a
No known key found for this signature in database
GPG Key ID: 754A66CCF3F73C0F
2 changed files with 16 additions and 1 deletions

View File

@ -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,8 +609,12 @@ public class VRAppState extends AbstractAppState {
settings.setFrequency(environment.getVRHardware().getDisplayFrequency());
settings.setFullscreen(false);
settings.setVSync(false); // stop vsyncing on primary monitor!
// TODO: Is this preventing desktop display on _ALL_ HMDs?
if(!(getVRHardware() instanceof OculusVR)) {
settings.setSwapBuffers(environment.isSwapBuffers());
}
}
// Updating application settings
stateManager.getApplication().setSettings(settings);

View File

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