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

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

I think I'm missing what everyone is arguing about. As far as I can see it there is only 1 issue. Should WebGL **optionally** support color space conversion when calling TexImage2D and TexSubImage2D.  That's it.

WebGL already specifies that if the incoming format is a lossless 8bit format (ie, an 8bit png) that the bits in the file must be passed straight through, no conversion. There are conformance tests for this. This is to support getting non-image data into WebGL. 

The only question that came up should there be an **option** to let the browser do color space conversion (and should that conversion be explicit). The simplest form of that is "should the browser be allowed to do whatever it normally does for img tags". 

Right now the browser is not allowed to change it bits if the source image is a lossless 8bit format. If you want it to do it's "normal" color conversion thing where normal is unspecified then you first paste your image into a canvas then use the canvas as your source for texImage2D. If your browser happens to do color space conversion you'd get the converted colors using that path since once it's pasted into canvas there's no way to know what it was originally or get the original bits.

So, the question came up, should we have a flag to let the color space conversion happen without having to do so by pasting into a canvas.


which is just a flag to tell the browser it can do whatever it wants

If you're on a browser that does color space conversions (firefox) your images will match what it does for img tags on the page. If your'e on a browser that doesn't do color space conversion (safari/chrome) again, your images will match what it does for img tags on the page. Note again, this is only for 8bit lossless formats. For all other formats it's completely up to the browser.