In my application the canvas element can be removed and re-added to the dom.
This has worked fine until I enabled a transparent clear color. With a transparent clear color I get the effect that is demonstrated by this playground: Babylon.js Playground.
I tried setting myScene.autoClear = true but it does not seem to have an effect.
I suspect something happens when I’ve registered the new canvas element:
updateCanvas(canvas) {
const engine = this._scene.getEngine();
const camera = this.get('camera');
engine.inputElement = canvas;
camera.detachControl();
engine.unRegisterView(engine.getRenderingCanvas());
engine.registerView(canvas, camera);
camera.attachControl();
}
I guess I need to change some property somewhere after I’ve re-registered the new canvas element but I’m not sure what.