EXT_sRGB extension

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since February 2020.

The EXT_sRGB extension is part of the WebGL API and adds sRGB support to textures and framebuffer objects.

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 WebGL1 contexts. In WebGL2, the functionality of this extension is available on the WebGL2 context by default. The constants in WebGL2 are: gl.SRGB, gl.SRGB8, gl.SRGB8_ALPHA8 and gl.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING.

Constants

This extension exposes the following constants, which can be used in the texImage2D(), texSubImage2D(), renderbufferStorage() and getFramebufferAttachmentParameter() methods.

ext.SRGB_EXT

Unsized sRGB format that leaves the precision up to the driver.

ext.SRGB_ALPHA_EXT

Unsized sRGB format with unsized alpha component.

ext.SRGB8_ALPHA8_EXT

Sized (8-bit) sRGB and alpha formats.

ext.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT

Returns the framebuffer color encoding (gl.LINEAR or ext.SRGB_EXT).

Examples

js
const ext = gl.getExtension("EXT_sRGB");

const texture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture);

gl.texImage2D(
  gl.TEXTURE_2D,
  0,
  ext.SRGB_EXT,
  512,
  512,
  0,
  ext.SRGB_EXT,
  gl.UNSIGNED_BYTE,
  image,
);

Specifications

Specification
WebGL EXT_sRGB Extension Specification

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
EXT_sRGB
Chrome – Full support
Chrome 40 (Release date: 2015-01-21)
footnote Full support
Edge – Full support
Edge 80 (Release date: 2020-02-07)
footnote Full support
Firefox – Partial support
Firefox 28 – 57 (Release date: 2014-03-18)
footnote Partial support
footnote Not supported on Windows.
Firefox – Full support
Firefox 58 (Release date: 2018-01-23)
footnote Full support
Opera – Full support
Opera 27 (Release date: 2015-01-27)
footnote Full support
Safari – Full support
Safari 9 (Release date: 2015-09-30)
footnote Full support
Chrome Android – Full support
Chrome Android 40 (Release date: 2015-01-21)
footnote Full support
Firefox for Android – Full support
Firefox for Android 28 (Release date: 2014-03-18)
footnote Full support
Opera Android – Full support
Opera Android 27 (Release date: 2015-01-29)
footnote Full support
Safari on iOS – Full support
Safari on iOS 9 (Release date: 2015-09-16)
footnote Full support
Samsung Internet – Full support
Samsung Internet 4 (Release date: 2016-03-11)
footnote Full support
WebView Android – Full support
WebView Android 40 (Release date: 2015-01-21)
footnote Full support
WebView on iOS – Full support
WebView on iOS 9 (Release date: 2015-09-16)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
Has more compatibility info.

See also