Преглед на файлове

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 );