Hey!
After some time I have context lost/restored events, but my scene can’t be properly updated
Errors:
In game(icons and text are working because it is HTML layer):
Interesting that purple circles have been built with MeshBuilder, all others objects - my glbs.
Any ideas why others objects can’t be rebuild?
Some notes:
- I use aggressive optimization + freezeActiveMeshes
Scene:
this.performancePriority = BABYLON.ScenePerformancePriority.Aggressive;
this.skipPointerMovePicking = true;
this.autoClear = false;
this.skipFrustumClipping = true;
this.autoClearDepthAndStencil = false;
Engine:
const engine = new Engine(
canvas,
false,
{ audioEngine: false, stencil: true, powerPreference: 'low-power', doNotHandleContextLost: true },
true
);
// copy pasted from github to solve issue with high-power
// https://github.com/BabylonJS/Babylon.js/pull/13680
engine._onContextLost = (evt: Event) => {
evt.preventDefault();
engine._contextWasLost = true;
console.warn('WebGL context lost.');
engine.onContextLostObservable.notifyObservers(engine);
};
engine._onContextRestored = () => {
engine._restoreEngineAfterContextLost(engine._initGLContext.bind(engine));
};
canvas.addEventListener('webglcontextlost', engine._onContextLost, false);
canvas.addEventListener('webglcontextrestored', engine._onContextRestored, false);