Skip to content

Instantly share code, notes, and snippets.

@DigiTec
Last active September 10, 2018 23:08
Show Gist options
  • Save DigiTec/5b022428946a85b936017412dc5b0dbd to your computer and use it in GitHub Desktop.
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 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