Last active
September 10, 2018 23:08
-
-
Save DigiTec/5b022428946a85b936017412dc5b0dbd to your computer and use it in GitHub Desktop.
Shows how to request 72hz rendering on the Go. Can be combined with samples at https://webvr.info/samples/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is connected to your "Enter WebVR" button | |
function onVRRequestPresent () { | |
console.log("onVRRequestPresent begin"); | |
// This can only be called in response to a user gesture. | |
var attributes = { | |
highRefreshRate: true, | |
}; | |
vrDisplay.requestPresent([{source: webglCanvas, attributes: attributes}]).then(function () { | |
// Nothing to do because we're handling things in onVRPresentChange. | |
console.log("highRefreshRate = " + vrDisplay.getLayers()[0].attributes.highRefreshRate); | |
}, function (err) { | |
var errMsg = "requestPresent failed."; | |
if (err && err.message) { | |
errMsg += "<br/>" + err.message | |
} | |
VRSamplesUtil.addError(errMsg, 2000); | |
console.log("onVRRequestPresent: errMsg"); | |
}); | |
console.log("onVRRequestPresent end"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment