Browse Source

feat-gltf-exporter: Set context attributes for getContext calls (#28893)

Gleb Myznikov 1 year ago
parent
commit
0a7f9b6335
1 changed files with 6 additions and 2 deletions
  1. 6 2
      examples/jsm/exporters/GLTFExporter.js

+ 6 - 2
examples/jsm/exporters/GLTFExporter.js

@@ -871,7 +871,9 @@ class GLTFWriter {
 		canvas.width = width;
 		canvas.width = width;
 		canvas.height = height;
 		canvas.height = height;
 
 
-		const context = canvas.getContext( '2d' );
+		const context = canvas.getContext( '2d', {
+			willReadFrequently: true,
+		} );
 		context.fillStyle = '#00ffff';
 		context.fillStyle = '#00ffff';
 		context.fillRect( 0, 0, width, height );
 		context.fillRect( 0, 0, width, height );
 
 
@@ -1273,7 +1275,9 @@ class GLTFWriter {
 			canvas.width = Math.min( image.width, options.maxTextureSize );
 			canvas.width = Math.min( image.width, options.maxTextureSize );
 			canvas.height = Math.min( image.height, options.maxTextureSize );
 			canvas.height = Math.min( image.height, options.maxTextureSize );
 
 
-			const ctx = canvas.getContext( '2d' );
+			const ctx = canvas.getContext( '2d', {
+				willReadFrequently: true,
+			} );
 
 
 			if ( flipY === true ) {
 			if ( flipY === true ) {