大网数据广告活动
Web 标准与前端开发

EXT_texture_norm16 extension

· 52CE 我爱测

The **`EXT_texture_norm16`** extension is part of the WebGL API and provides a set of new 16-bit signed normalized and unsigned normalized formats (fixed-point texture, renderbuffer and texture buffer).

WebGL

The EXT_texture_norm16 extension is part of the WebGL API and provides a set of new 16-bit signed normalized and unsigned normalized formats (fixed-point texture, renderbuffer and texture buffer).

When this extension is enabled:

  • The WebGLRenderingContext.texImage2D() and WebGLRenderingContext.texSubImage2D() methods accept new formats provided by this extension.
  • The 16-bit normalized fixed-point types ext.R16_EXT, ext.RG16_EXT and ext.RGBA16_EXT become available as color-renderable formats and renderbuffers and be created in these formats.

WebGL extensions are available using the WebGLRenderingContext.getExtension() method. For more information, see Using WebGL extensions.

[!NOTE] This extension is only available to WebGL2RenderingContext contexts.

Constants

  • ext.R16_EXT
    • : Red 16-bit unsigned format. Color-renderable.
  • ext.RG16_EXT
    • : RG 16-bit unsigned format. Color-renderable.
  • ext.RGB16_EXT
    • : RGB 16-bit unsigned format.
  • ext.RGBA16_EXT
    • : RGBA 16-bit unsigned format. Color-renderable.
  • ext.R16_SNORM_EXT
    • : Red 16-bit signed normalized format.
  • ext.RG16_SNORM_EXT
    • : RG 16-bit signed normalized format.
  • ext.RGB16_SNORM_EXT
    • : RGB 16-bit signed normalized format.
  • ext.RGBA16_SNORM_EXT
    • : RGBA 16-bit signed normalized format.

Examples

Enabling the extension

let ext = gl.getExtension("EXT_texture_norm16");

Texture formats

The WebGLRenderingContext.texImage2D() method accepts new formats when EXT_texture_norm16 is enabled. Example calls:

// imageData = Uint16Array
gl.texImage2D(gl.TEXTURE_2D, 0, ext.R16_EXT, 1, 1, 0, gl.RED, gl.UNSIGNED_SHORT, imageData);
gl.texImage2D(gl.TEXTURE_2D, 0, ext.RG16_EXT, 1, 1, 0, gl.RG, gl.UNSIGNED_SHORT, imageData);
gl.texImage2D(gl.TEXTURE_2D, 0, ext.RGB16_EXT, 1, 1, 0, gl.RGB, gl.UNSIGNED_SHORT, imageData);
gl.texImage2D(gl.TEXTURE_2D, 0, ext.RGBA16_EXT, 1, 1, 0, gl.RGBA, gl.UNSIGNED_SHORT, imageData);

// imageData = Int16Array
gl.texImage2D(gl.TEXTURE_2D, 0, ext.R16_SNORM_EXT, 1, 1, 0, gl.RED, gl.SHORT, imageData);
gl.texImage2D(gl.TEXTURE_2D, 0, ext.RG16_SNORM_EXT, 1, 1, 0, gl.RG, gl.SHORT, imageData);
gl.texImage2D(gl.TEXTURE_2D, 0, ext.RGB16_SNORM_EXT, 1, 1, 0, gl.RGB, gl.SHORT, imageData);
gl.texImage2D(gl.TEXTURE_2D, 0, ext.RGBA16_SNORM_EXT, 1, 1, 0, gl.RGBA, gl.SHORT, imageData);

Renderbuffer formats

The WebGLRenderingContext.renderbufferStorage() method accepts ext.R16_EXT, ext.RG16_EXT and ext.RGBA16_EXT as internal formats to create renderbuffers in these formats. Example calls:

gl.renderbufferStorage(gl.RENDERBUFFER, ext.R16_EXT, 1, 1);
gl.renderbufferStorage(gl.RENDERBUFFER, ext.RG16_EXT, 1, 1);
gl.renderbufferStorage(gl.RENDERBUFFER, ext.RGBA16_EXT, 1, 1);

Specifications

Browser compatibility

See also

  • WebGLRenderingContext.getExtension()
  • WebGLRenderingContext.texImage2D()
  • WebGLRenderingContext.renderbufferStorage()

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。