From 60b089ab5b47458f26280becf6c8f1fc4b8d9378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Silvan=20Str=C3=BCbi?= Date: Mon, 20 Jan 2020 18:09:26 +0100 Subject: [PATCH] Update WebGLSpriteBatch.js reverted #641 --- src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js b/src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js index f1cb6e4a2..466e6cf6e 100644 --- a/src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js +++ b/src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js @@ -253,6 +253,15 @@ PIXI.WebGLSpriteBatch.prototype.end = function () PIXI.WebGLSpriteBatch.prototype.render = function (sprite, matrix) { var texture = sprite.texture; + var baseTexture = texture.baseTexture; + var gl = this.gl; + if (PIXI.WebGLRenderer.textureArray[baseTexture.textureIndex] != baseTexture) // eslint-disable-line eqeqeq + { + this.flush(); + gl.activeTexture(gl.TEXTURE0 + baseTexture.textureIndex); + gl.bindTexture(gl.TEXTURE_2D, baseTexture._glTextures[gl.id]); + PIXI.WebGLRenderer.textureArray[baseTexture.textureIndex] = baseTexture; + } // They provided an alternative rendering matrix, so use it var wt = sprite.worldTransform;