Sfoglia il codice sorgente

Is this necessary?

Popov72 5 anni fa
parent
commit
3ebb8bfe8e
1 ha cambiato i file con 9 aggiunte e 1 eliminazioni
  1. 9 1
      serializers/src/glTF/2.0/glTFMaterialExporter.ts

+ 9 - 1
serializers/src/glTF/2.0/glTFMaterialExporter.ts

@@ -515,7 +515,15 @@ export class _GLTFMaterialExporter {
                 tempTexture.dispose();
 
                 // Read data from WebGL
-                const canvas = engine.getRenderingCanvas();
+                const canvas0 = engine.getRenderingCanvas();
+
+                const canvas = document.createElement("canvas");
+
+                canvas.width = canvas0?.width ?? 0;
+                canvas.height = canvas0?.height ?? 0;
+
+                var destCtx = canvas.getContext('2d');
+                destCtx!.drawImage(canvas0!, 0, 0);
 
                 if (canvas) {
                     if (!canvas.toBlob) { // fallback for browsers without "canvas.toBlob"