diff --git a/packages/dev/core/src/Engines/engine.ts b/packages/dev/core/src/Engines/engine.ts index b870b6a90cf..2704e63faa2 100755 --- a/packages/dev/core/src/Engines/engine.ts +++ b/packages/dev/core/src/Engines/engine.ts @@ -359,12 +359,6 @@ export class Engine extends ThinEngine { this._features.supportRenderPasses = true; options = this._creationOptions; - - if ((canvasOrContext).getContext) { - const canvas = canvasOrContext; - - this._sharedInit(canvas); - } } protected override _initGLContext(): void { diff --git a/packages/dev/core/src/Engines/thinEngine.ts b/packages/dev/core/src/Engines/thinEngine.ts index 7dc224d2569..b36ace0b21b 100644 --- a/packages/dev/core/src/Engines/thinEngine.ts +++ b/packages/dev/core/src/Engines/thinEngine.ts @@ -282,7 +282,6 @@ export class ThinEngine extends AbstractEngine { let canvas: Nullable = null; if ((canvasOrContext as any).getContext) { canvas = canvasOrContext; - this._renderingCanvas = canvas; if (options.preserveDrawingBuffer === undefined) { options.preserveDrawingBuffer = false; @@ -397,7 +396,7 @@ export class ThinEngine extends AbstractEngine { } } else { this._gl = canvasOrContext; - this._renderingCanvas = this._gl.canvas as HTMLCanvasElement; + canvas = this._gl.canvas as HTMLCanvasElement; if ((this._gl as any).renderbufferStorageMultisample) { this._webGLVersion = 2.0; @@ -412,6 +411,8 @@ export class ThinEngine extends AbstractEngine { } } + this._sharedInit(canvas); + // Ensures a consistent color space unpacking of textures cross browser. this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE);