Browse Source

Merge pull request #9078 from Popov72/fix-shadow-flash

Shadow generator: Fix flash at start when using filtering methods making use of preprocesses
David Catuhe 4 years ago
parent
commit
ebddd883b3
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/Engines/Extensions/engine.renderTarget.ts

+ 3 - 1
src/Engines/Extensions/engine.renderTarget.ts

@@ -100,6 +100,8 @@ ThinEngine.prototype.createRenderTargetTexture = function(this: ThinEngine, size
 
     this._bindTextureDirectly(target, null);
 
+    const currentFrameBuffer = this._currentFramebuffer;
+
     // Create the framebuffer
     const framebuffer = gl.createFramebuffer();
     this._bindUnboundFramebuffer(framebuffer);
@@ -110,7 +112,7 @@ ThinEngine.prototype.createRenderTargetTexture = function(this: ThinEngine, size
         gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._webGLTexture, 0);
     }
 
-    this._bindUnboundFramebuffer(null);
+    this._bindUnboundFramebuffer(currentFrameBuffer);
 
     texture._framebuffer = framebuffer;
     texture.baseWidth = width;