浏览代码

WebGLUtils: Move `RedFormat` to WebGL 2 section. (#24945)

* Move line

* Update docs
Levi Pesin 3 年之前
父节点
当前提交
9b16947a31
共有 2 个文件被更改,包括 4 次插入2 次删除
  1. 3 1
      docs/api/en/constants/Textures.html
  2. 1 1
      src/renderers/webgl/WebGLUtils.js

+ 3 - 1
docs/api/en/constants/Textures.html

@@ -156,7 +156,9 @@
 
 
 		[page:constant AlphaFormat] discards the red, green and blue components and reads just the alpha component.<br /><br />
 		[page:constant AlphaFormat] discards the red, green and blue components and reads just the alpha component.<br /><br />
 
 
-		[page:constant RedFormat] discards the green and blue components and reads just the red component.<br /><br />
+		[page:constant RedFormat] discards the green and blue components and reads just the red component.
+		(can only be used with a WebGL 2 rendering context).
+		<br /><br />
 
 
 		[page:constant RedIntegerFormat] discards the green and blue components and reads just the red component.
 		[page:constant RedIntegerFormat] discards the green and blue components and reads just the red component.
 		The texels are read as integers instead of floating point.
 		The texels are read as integers instead of floating point.

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

@@ -43,7 +43,6 @@ function WebGLUtils( gl, extensions, capabilities ) {
 		if ( p === LuminanceAlphaFormat ) return gl.LUMINANCE_ALPHA;
 		if ( p === LuminanceAlphaFormat ) return gl.LUMINANCE_ALPHA;
 		if ( p === DepthFormat ) return gl.DEPTH_COMPONENT;
 		if ( p === DepthFormat ) return gl.DEPTH_COMPONENT;
 		if ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL;
 		if ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL;
-		if ( p === RedFormat ) return gl.RED;
 
 
 		// @deprecated since r137
 		// @deprecated since r137
 
 
@@ -74,6 +73,7 @@ function WebGLUtils( gl, extensions, capabilities ) {
 
 
 		// WebGL2 formats.
 		// WebGL2 formats.
 
 
+		if ( p === RedFormat ) return gl.RED;
 		if ( p === RedIntegerFormat ) return gl.RED_INTEGER;
 		if ( p === RedIntegerFormat ) return gl.RED_INTEGER;
 		if ( p === RGFormat ) return gl.RG;
 		if ( p === RGFormat ) return gl.RG;
 		if ( p === RGIntegerFormat ) return gl.RG_INTEGER;
 		if ( p === RGIntegerFormat ) return gl.RG_INTEGER;