@@ -86,12 +86,13 @@ var BABYLON = BABYLON || {};
// Render
this._renderingManager.render(this.customRenderFunction, this.renderList, this.renderParticles, this.renderSprites);
- // Unbind
- engine.unBindFramebuffer(this._texture);
-
+ //Call this before unBinding Framebuffer in case of manipulating texture with WebGL commands inside the onAfterRender method.
if (this.onAfterRender) {
this.onAfterRender();
}
+
+ // Unbind
+ engine.unBindFramebuffer(this._texture);
};
BABYLON.RenderTargetTexture.prototype.clone = function () {
@@ -272,6 +272,8 @@ var BABYLON = BABYLON || {};
gl.generateMipmap(gl.TEXTURE_2D);
gl.bindTexture(gl.TEXTURE_2D, null);
+ this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, null);
BABYLON.Engine.prototype.flushFramebuffer = function () {