From 2e437e6304a3613c3222ee1cb88a77e44056b847 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Sun, 25 Apr 2021 18:55:14 -0700 Subject: [PATCH 1/2] clone rendertarget.texture image data --- src/renderers/WebGLRenderTarget.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/renderers/WebGLRenderTarget.js b/src/renderers/WebGLRenderTarget.js index e113c9d712892f..f5a037179bdcde 100644 --- a/src/renderers/WebGLRenderTarget.js +++ b/src/renderers/WebGLRenderTarget.js @@ -88,7 +88,10 @@ class WebGLRenderTarget extends EventDispatcher { this.viewport.copy( source.viewport ); + // By default texture.clone retains a reference to the original image data which + // isn't correct for WebGLRenderTarget. See issue #20328. this.texture = source.texture.clone(); + this.texture.image = { ...this.texture.image }; this.depthBuffer = source.depthBuffer; this.stencilBuffer = source.stencilBuffer; From 6bbff80ecd3d0e2b9c706c84336803a628673145 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Mon, 26 Apr 2021 06:41:51 -0700 Subject: [PATCH 2/2] rework comment --- src/renderers/WebGLRenderTarget.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/renderers/WebGLRenderTarget.js b/src/renderers/WebGLRenderTarget.js index f5a037179bdcde..319dec1ed0c38c 100644 --- a/src/renderers/WebGLRenderTarget.js +++ b/src/renderers/WebGLRenderTarget.js @@ -88,10 +88,8 @@ class WebGLRenderTarget extends EventDispatcher { this.viewport.copy( source.viewport ); - // By default texture.clone retains a reference to the original image data which - // isn't correct for WebGLRenderTarget. See issue #20328. this.texture = source.texture.clone(); - this.texture.image = { ...this.texture.image }; + this.texture.image = { ...this.texture.image }; // See #20328. this.depthBuffer = source.depthBuffer; this.stencilBuffer = source.stencilBuffer;