Browse Source

fix array size calc (#28161)

Co-authored-by: aardgoose <[email protected]>
aardgoose 1 year ago
parent
commit
df2bdbe4c9
1 changed files with 1 additions and 1 deletions
  1. 1 1
      examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js

+ 1 - 1
examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js

@@ -706,7 +706,7 @@ class WebGLTextureUtils {
 
 		await backend.utils._clientWaitAsync();
 
-		const dstBuffer = new typedArrayType( elementCount );
+		const dstBuffer = new typedArrayType( byteLength / typedArrayType.BYTES_PER_ELEMENT );
 
 		gl.bindBuffer( gl.PIXEL_PACK_BUFFER, buffer );
 		gl.getBufferSubData( gl.PIXEL_PACK_BUFFER, 0, dstBuffer );