diff --git a/src/pixi/renderers/webgl/WebGLRenderer.js b/src/pixi/renderers/webgl/WebGLRenderer.js index c75bbb4..0be1910 100644 --- a/src/pixi/renderers/webgl/WebGLRenderer.js +++ b/src/pixi/renderers/webgl/WebGLRenderer.js @@ -258,11 +258,14 @@ PIXI.WebGLRenderer.prototype.renderDisplayObject = function(displayObject, projection, buffer) { this.renderSession.blendModeManager.setBlendMode(PIXI.blendModes.NORMAL); + // reset the render session data.. this.renderSession.drawCount = 0; - this.renderSession.currentBlendMode = 9999; + // set the default projection this.renderSession.projection = projection; + + //set the default offset this.renderSession.offset = this.offset; // start the sprite batch @@ -304,7 +307,7 @@ }; /** - * Updates and Creates a WebGL texture + * Updates and Creates a WebGL texture for the renderers context * * @method updateTexture * @param texture {Texture} the texture to render @@ -356,7 +359,6 @@ this.contextLost = true; }; - /** * Handles a restored webgl context * @@ -366,7 +368,6 @@ */ PIXI.WebGLRenderer.prototype.handleContextRestored = function() { - this.initContext(); // empty all the ol gl textures as they are useless now diff --git a/src/pixi/renderers/webgl/WebGLRenderer.js b/src/pixi/renderers/webgl/WebGLRenderer.js index c75bbb4..0be1910 100644 --- a/src/pixi/renderers/webgl/WebGLRenderer.js +++ b/src/pixi/renderers/webgl/WebGLRenderer.js @@ -258,11 +258,14 @@ PIXI.WebGLRenderer.prototype.renderDisplayObject = function(displayObject, projection, buffer) { this.renderSession.blendModeManager.setBlendMode(PIXI.blendModes.NORMAL); + // reset the render session data.. this.renderSession.drawCount = 0; - this.renderSession.currentBlendMode = 9999; + // set the default projection this.renderSession.projection = projection; + + //set the default offset this.renderSession.offset = this.offset; // start the sprite batch @@ -304,7 +307,7 @@ }; /** - * Updates and Creates a WebGL texture + * Updates and Creates a WebGL texture for the renderers context * * @method updateTexture * @param texture {Texture} the texture to render @@ -356,7 +359,6 @@ this.contextLost = true; }; - /** * Handles a restored webgl context * @@ -366,7 +368,6 @@ */ PIXI.WebGLRenderer.prototype.handleContextRestored = function() { - this.initContext(); // empty all the ol gl textures as they are useless now diff --git a/src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js b/src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js index 5ec854c..c6aba1d 100755 --- a/src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js +++ b/src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js @@ -432,13 +432,15 @@ var currentBaseTexture = null; var currentBlendMode = this.renderSession.blendModeManager.currentBlendMode; + var blendSwap = false; for (var i = 0, j = this.currentBatchSize; i < j; i++) { nextTexture = this.textures[i]; nextBlendMode = this.blendModes[i]; - - if(currentBaseTexture !== nextTexture || currentBlendMode !== nextBlendMode) + blendSwap = currentBlendMode !== nextBlendMode; + + if(currentBaseTexture !== nextTexture || blendSwap) { this.renderBatch(currentBaseTexture, batchSize, start); @@ -447,7 +449,7 @@ currentBaseTexture = nextTexture; currentBlendMode = nextBlendMode; - this.renderSession.blendModeManager.setBlendMode( currentBlendMode ); + if( blendSwap )this.renderSession.blendModeManager.setBlendMode( currentBlendMode ); } batchSize++;