Skip to content

Commit

Permalink
Update WebGLSpriteBatch.js
Browse files Browse the repository at this point in the history
reverted phaserjs#641
  • Loading branch information
Weedshaker authored Jan 20, 2020
1 parent 80fee66 commit 60b089a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 60b089a

Please sign in to comment.