浏览代码

Merge pull request #177 from nicolas-obre/RenderTargetTextureFix

Fixing an issue with Internet Explorer while rendering a RenderTargetTexture outside the engine renderLoop.
deltakosh 11 年之前
父节点
当前提交
8008db744f
共有 2 个文件被更改,包括 6 次插入3 次删除
  1. 4 3
      Babylon/Materials/textures/babylon.renderTargetTexture.js
  2. 2 0
      Babylon/babylon.engine.js

+ 4 - 3
Babylon/Materials/textures/babylon.renderTargetTexture.js

@@ -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 () {

+ 2 - 0
Babylon/babylon.engine.js

@@ -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 () {