dEventListener('end', () => xrButton.setSession(null));

        initGL();
        scene.inputRenderer.useProfileControllerMeshes(session);

        session.updateRenderState({
          baseLayer : new XRWebGLLayer(session, gl)
        });

        let refSpaceType = session.isImmersive ? 'local-floor' : 'viewer';
        session.requestReferenceSpace(refSpaceType).then((refSpace) => {
          if (session.isImmersive) {
            xrImmersiveRefSpace = refSpace;
          } else {
            inlineView