WebGL texImage2D DOM helpers conversions

XXX. Conversion from DOM element into WebGLTexture internal format

Any DOM element whose source format is not in RGB colorspace (e.g CYMK) is initially converted into RGB colorspace as usually performed by browsers [REF?] if access to at least one of R, G or B component is required.

Table XXX.Y summarizes the supported conversions with :

internalformat parameterStorage representationRGBA sourceRGB  sourceRA   sourceR    sourceA    source
ALPHAA0, 0, 0, A0, 0, 0, 10, 0, 0, A0, 0, 0, R0, 0, 0, A
LUMINANCERR, R, R, 1R, R, R, 1R, R, R, 1R, R, R, 1A, A, A, 1
LUMINANCE_ALPHARAR, R, R, AR, R, R, 1 R, R, R, AR, R, R, 10, 0, 0, A
RGBRGBR, G, B, 1R, G, B, 1R, R, R, 1R, R, R, 1A, A, A, 1
RGBARGBAR, G, B, AR, G, B, 1R, R, R, AR, R, R, 10, 0, 0, A
Example 1: If internalformat is ALPHA and the DOM source is RGBA, texture will be stored as a sequence of A pixels with A the value of the alpha-channel for every source pixel.
Example 2: If internalformat is LUMINANCE_ALPHA and the DOM source is RGB, texture will be stored as a sequence of RA pixels with R the value of the red-color channel and A equal to 1.0.