Skip to content

Commit

Permalink
Fix button not showing 'Exit VR' when a session starts
Browse files Browse the repository at this point in the history
  • Loading branch information
toji committed Jan 27, 2025
1 parent ab8b4a4 commit 082da25
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions layers-samples/proj-layer.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@
function onSessionStarted(session) {
xrSession = session;

// This informs the 'Enter XR' button that the session has started and
// that it should display 'Exit XR' instead.
xrButton.setSession(session);

// Render correct controller models if supported by WebXR input profile
scene.inputRenderer.useProfileControllerMeshes(session);

Expand Down Expand Up @@ -162,9 +166,7 @@
}

function onSessionEnded(event) {
if (event.session.isImmersive) {
xrButton.setSession(null);
}
xrButton.setSession(null);
xrSession = null;

// In this simple case discard the WebGL context too, since we're not
Expand Down Expand Up @@ -193,7 +195,7 @@
if (usingTextureArray) {
gl.framebufferTextureLayer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, glLayer.colorTexture, 0, glLayer.imageIndex);
gl.framebufferTextureLayer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, glLayer.depthStencilTexture, 0, glLayer.imageIndex);

// No need to set the scissor when clearing a layered texture, since only one layer is exposed at a time.
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);

Expand Down

0 comments on commit 082da25

Please sign in to comment.