immersive-web / cardboard-vr-display

A JavaScript implementation of a WebVR 1.1 VRDisplay
https://immersive-web.github.io/cardboard-vr-display
Apache License 2.0
92 stars 43 forks source link

When calling requestPresent with a new `source`, swap without leaving fullscreen. #16

Closed jsantell closed 6 years ago

jsantell commented 6 years ago

When calling requestPresent with a new canvas, do not exit fullscreen and swap canvases. Necessary for presenting via user-gesture before a canvas can be acquired, like for the WebXR polyfill, which needs to create a session via user-gesture, but does not have a canvas until baseLayer is set. Similarly in polyfill land, there are browsers that require a user-gesture for fullscreen (at least Firefox/Android from my testing). In order to polyfill a WebXR style way of presenting on Cardboard/1.1, we must call requestPresent with a dummy canvas and preserve the fullscreen request, and subsequently call requestPresent again with the real canvas from the session's baseLayer.