浏览代码

Merge pull request #19710 from felixpalmer/copy-texture-to-texture-fix

copyTextureToTexture pixelStorei fix to prevent upside-down texture uploads
Mr.doob 5 年之前
父节点
当前提交
87bd3ad631
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      src/renderers/WebGLRenderer.js

+ 6 - 0
src/renderers/WebGLRenderer.js

@@ -1961,6 +1961,12 @@ function WebGLRenderer( parameters ) {
 
 		textures.setTexture2D( dstTexture, 0 );
 
+		// As another texture upload may have changed pixelStorei
+		// parameters, make sure they are correct for the dstTexture
+		_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY );
+		_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );
+		_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );
+
 		if ( srcTexture.isDataTexture ) {
 
 			_gl.texSubImage2D( _gl.TEXTURE_2D, level, position.x, position.y, width, height, glFormat, glType, srcTexture.image.data );