[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Gamma correction and texImage2D/texSubImage2D



The way browsers currently handle colour space is fairly simple, the actual format does not matter:

  * The image includes a colour profile: then use that colour profile
  * The image does not include a colour profile: then assume the image is in sRGB

This is the model that WebGL texture loading should follow in order to be consistent with other web content.

Obviously WebGL will need an API to load raw (un "corrected") data into a texture in order to handle a few use cases, but other than that additional API there shouldn't be any other logic necessary.

Basically the complete (image to display) model is:

            Image                       WebGL Context                       Display
  <arbitrary colour space>  -> match ->   Linear RGB   -> match ->   <arbitrary colour space>

With an option to do
            Image                       WebGL Context                       Display
  <arbitrary colour space>  ->  nop  ->   Linear RGB   -> match ->   <arbitrary colour space>

The actual file formats, and the actual mechanism of matching isn't relevant, all that we need to do is guarantee the colour space of the GL context.

--Oliver