WebGL
Khronos
 

WebGL EXT_sRGB Extension Specification

Name

EXT_sRGB

Contact

WebGL working group (public_webgl 'at' khronos.org)

Contributors

Florian Boesch (pyalot 'at' gmail.com)

Members of the WebGL working group

Version

Last modified date: July 15, 2014
Revision: 4

Number

WebGL extension #17

Dependencies

Written against the WebGL API 1.0 specification.

Overview

This extension exposes the EXT_sRGB functionality to WebGL.

There are no WebGL-specific behavioral changes.

Consult the above extension for documentation, issues and new functions and enumerants.

When this extension is enabled:

IDL

    [NoInterfaceObject]
    interface EXT_sRGB {
      const GLenum SRGB_EXT                                     = 0x8C40;
      const GLenum SRGB_ALPHA_EXT                               = 0x8C42;
      const GLenum SRGB8_ALPHA8_EXT                             = 0x8C43;
      const GLenum FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT    = 0x8210;
    };
  

New Tokens

texImage2D(GLenum format, GLenum internalformat)
Accepted by the format and internalformat parameters: SRGB_EXT and SRGB_ALPHA_EXT
texSubImage2D(GLenum format)
Accepted by the format parameter: SRGB_EXT and SRGB_ALPHA_EXT
renderbufferStorage(GLenum internalformat)
Accepted by the internalformat parameter: SRGB_ALPHA8_EXT
getFramebufferAttachmentParameter(GLenum pname)
Accepted by the pname parameter: FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT

Sample Code

        var ext = gl.getExtension('EXT_sRGB');
        var texture = gl.createTexture();
        gl.bindTexture(gl.TEXTURE_2D, texture);
        texImage2D(gl.TEXTURE_2D, 0, ext.SRGB_EXT, 256, 256, 0, ext.SRGB_EXT, gl.UNSIGNED_BYTE, data);
    

Revision History

Revision 1, 2012/12/16

Revision 2, 2013/01/26

Revision 3, 2014/05/13

Revision 4, 2014/07/15