EXT\_texture\_norm16 extension
==============================

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 also Using Extensions in the WebGL tutorial.

**Note:** This extension is only available to WebGL 2 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


```js
let ext = gl.getExtension("EXT\_texture\_norm16");
```

### Texture formats

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


```js
// 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:


```js
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
--------------

| Specification |
| --- |
| WebGL EXT\_texture\_norm16 Extension Specification  |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `WebGLRenderingContext.getExtension()`
* `WebGLRenderingContext.texImage2D()`
* `WebGLRenderingContext.renderbufferStorage()`