WebVR 1.1 spec compatibility

This commit is contained in:
Imanol Fernandez 2017-05-26 14:22:02 +02:00
parent 296a215e54
commit fe4ee6de2e
16 changed files with 112 additions and 55 deletions

View file

@ -168,10 +168,10 @@ found in the LICENSE file.
var frameData;
if (navigator.vr) {
if (navigator.getVRDisplays) {
frameData = new VRFrameData();
navigator.vr.getDisplays().then(function (displays) {
navigator.getVRDisplays().then(function (displays) {
if (displays.length > 0) {
vrDisplay = displays[0];
vrDisplay.depthNear = 0.1;
@ -190,9 +190,9 @@ found in the LICENSE file.
if (vrDisplay.capabilities.canPresent)
vrPresentButton = VRSamplesUtil.addButton("Enter VR", "E", "media/icons/cardboard64.png", onVRRequestPresent);
vrDisplay.addEventListener('presentchange', onVRPresentChange, false);
//vrDisplay.addEventListener('activate', onVRRequestPresent, false);
//vrDisplay.addEventListener('deactivate', onVRExitPresent, false);
window.addEventListener('vrdisplaypresentchange', onVRPresentChange, false);
window.addEventListener('vrdisplayactivate', onVRRequestPresent, false);
window.addEventListener('vrdisplaydeactivate', onVRExitPresent, false);
} else {
initWebGL();
VRSamplesUtil.addInfo("WebVR supported, but no VRDisplays found.", 3000);