Skip to content

Commit 70c68fb

Browse files
authored
Merge pull request #13944 from takahirox/FixCopyTextureToTexture
Fix WebGLRenderer copyTextureToTexture
2 parents ec67749 + 7f4c137 commit 70c68fb

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/renderers/WebGLRenderer.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2577,11 +2577,18 @@ function WebGLRenderer( parameters ) {
25772577
var height = srcTexture.image.height;
25782578
var glFormat = utils.convert( dstTexture.format );
25792579
var glType = utils.convert( dstTexture.type );
2580-
var pixels = srcTexture.isDataTexture ? srcTexture.image.data : srcTexture.image;
25812580

25822581
this.setTexture2D( dstTexture, 0 );
25832582

2584-
_gl.texSubImage2D( _gl.TEXTURE_2D, level || 0, position.x, position.y, width, height, glFormat, glType, pixels );
2583+
if ( srcTexture.isDataTexture ) {
2584+
2585+
_gl.texSubImage2D( _gl.TEXTURE_2D, level || 0, position.x, position.y, width, height, glFormat, glType, srcTexture.image.data );
2586+
2587+
} else {
2588+
2589+
_gl.texSubImage2D( _gl.TEXTURE_2D, level || 0, position.x, position.y, glFormat, glType, srcTexture.image );
2590+
2591+
}
25852592

25862593
};
25872594

0 commit comments

Comments
 (0)