diff --git a/CHANGELOG.md b/CHANGELOG.md index 4afb3ea95..1c011abf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ * `GameConfig.antialiasGL` is a new boolean that allows you to set the `antialias` property of the WebGL context during creation, without impacting any subsequent textures or the canvas CSS. +### Updates + +* When calling `Shader.setRenderToTexture()` it will now draw the shader just once, immediately to the texture, to avoid the texture being blank for a single frame (thanks Kyle) + ### Bug Fixes * `SpineCanvasPlugin.shutdown` would try to dispose of the `sceneRenderer`, but the property isn't set for Canvas. diff --git a/src/gameobjects/shader/Shader.js b/src/gameobjects/shader/Shader.js index 38814022f..ad879217a 100644 --- a/src/gameobjects/shader/Shader.js +++ b/src/gameobjects/shader/Shader.js @@ -454,6 +454,20 @@ var Shader = new Class({ } } + // And now render at least once, so our texture isn't blank on the first update + + if (this.shader) + { + var pipeline = renderer.currentPipeline; + + renderer.clearPipeline(); + + this.load(); + this.flush(); + + renderer.rebindPipeline(pipeline); + } + return this; },