Browse Source

WebGLTextures: Fix warning when using 3D Textures. (#24753)

* Fixed warning when using 3D Textures

Previously, calling `WebGLRenderer.setRenderTarget(texture3D, layer)` would cause a warning `framebufferTexture2D: Bad 'imageTarget': 0x806f` (where `0x806f` translates to `TEXTURE_3D`). The warning is inconsequential but annoying.

* Reversed test logic

to check for all valid texture targets explicitly

* Update WebGLTextures.js

Co-authored-by: Michael Herzog <[email protected]>
Clemens Sielaff 2 năm trước cách đây
mục cha
commit
eec492db99
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      src/renderers/webgl/WebGLTextures.js

+ 1 - 1
src/renderers/webgl/WebGLTextures.js

@@ -1269,7 +1269,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 			multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture, 0, getRenderTargetSamples( renderTarget ) );
 
-		} else {
+		} else if ( textureTarget === _gl.TEXTURE_2D || ( textureTarget >= _gl.TEXTURE_CUBE_MAP_POSITIVE_X && textureTarget <= _gl.TEXTURE_CUBE_MAP_NEGATIVE_Z ) ) { // see #24753
 
 			_gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture, 0 );