Hi, I have been missing WebGL Contexts when I was using HTC Vive to view VR. Could you please tell me how to restore the context or if there are other ways to re-render the context
viewer.cesiumWidget._useDefaultRenderLoop = false
var gl = viewer.scene.context._gl;
async function onSessionStarted(session) {
await setSession(session);
}
async function setSession(value) {
console.log(value)
session = value;
if (session !== null) {
const attributes = gl.getContextAttributes();
if (attributes.xrCompatible !== true) {
await gl.makeXRCompatible();
}
const layerInit = {
antialias: attributes.antialias,
alpha: attributes.alpha,
depth: attributes.depth,
stencil: attributes.stencil,
framebufferScaleFactor: 1.0
};
const baseLayer = new XRWebGLLayer(session, gl, layerInit);
session.updateRenderState({ baseLayer: baseLayer });
gl.bindFramebuffer(gl.FRAMEBUFFER, baseLayer.framebuffer)
function drawVRScene(t) {
viewer.cesiumWidget.resize()
viewer.cesiumWidget.render()
session.requestAnimationFrame(drawVRScene);
}
drawVRScene();
}
};
const sessionInit = { optionalFeatures: ['local-floor', 'bounded-floor', 'hand-tracking'] };
navigator.xr.requestSession('immersive-vr', sessionInit).then(onSessionStarted);
When the code executes gl.makexrcompatible (), the viewer. scene.context._gl is lost. Is there a way to recover it