Skip to content

Commit bc5c7cf

Browse files
committed
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)
1 parent 9f8e9d2 commit bc5c7cf

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
* `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.
88

9+
### Updates
10+
11+
* 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)
12+
913
### Bug Fixes
1014

1115
* `SpineCanvasPlugin.shutdown` would try to dispose of the `sceneRenderer`, but the property isn't set for Canvas.

src/gameobjects/shader/Shader.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,20 @@ var Shader = new Class({
454454
}
455455
}
456456

457+
// And now render at least once, so our texture isn't blank on the first update
458+
459+
if (this.shader)
460+
{
461+
var pipeline = renderer.currentPipeline;
462+
463+
renderer.clearPipeline();
464+
465+
this.load();
466+
this.flush();
467+
468+
renderer.rebindPipeline(pipeline);
469+
}
470+
457471
return this;
458472
},
459473

0 commit comments

Comments
 (0)