From d3e07b519a2318b66c37b8874a2389c81dd3f94a Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Thu, 26 Jul 2018 15:04:46 +0100 Subject: [PATCH] Added setBlankTexture method --- src/renderer/webgl/WebGLRenderer.js | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/renderer/webgl/WebGLRenderer.js b/src/renderer/webgl/WebGLRenderer.js index 1f4b61db3..a56da5037 100644 --- a/src/renderer/webgl/WebGLRenderer.js +++ b/src/renderer/webgl/WebGLRenderer.js @@ -533,12 +533,16 @@ var WebGLRenderer = new Class({ */ boot: function () { - this.blankTexture = this.game.textures.getFrame('__DEFAULT').glTexture; - for (var pipelineName in this.pipelines) { this.pipelines[pipelineName].boot(); } + + var blank = this.game.textures.getFrame('__DEFAULT'); + + this.pipelines.FlatTintPipeline.currentFrame = blank; + + this.blankTexture = blank; }, /** @@ -988,6 +992,24 @@ var WebGLRenderer = new Class({ return this; }, + /** + * Sets the current active texture for texture unit zero to be a blank texture. + * This only happens if there isn't a texture already in use by texture unit zero. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setBlankTexture + * @private + * @since 3.12.0 + * + * @return {Phaser.Renderer.WebGL.WebGLRenderer} This WebGL Renderer. + */ + setBlankTexture: function () + { + if (this.currentActiveTextureUnit !== 0 || !this.currentTextures[0]) + { + this.setTexture2D(this.blankTexture.glTexture, 0); + } + }, + /** * Binds a texture at a texture unit. If a texture is already * bound to that unit it will force a flush on the current pipeline.