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

[Public WebGL] Adding internalformat param to all texImage2d variants

In this thread:


we discussed the idea of adding the internalformat parameter to all the variants of texImage2D. This would take the incoming data from the ImageData, HTMLImageElement, HTMLCanvasElement, and HTMLVideoElement and convert it to the format needed for the passed internalformat. The rules take the incoming RGB or RGBA image and convert it like this:

internalformat/incoming data			RGB							RGBA
------------------------------------			------							--------
ALPHA							Convert to grayscale			Use alpha, ignore RGB
LUMINANCE						Convert to grayscale			Convert RGB to grayscale, ignore alpha
LUMINANCE_ALPHA				Convert to grayscale, alpha=1		Convert RGB to grayscale, use alpha
RGB								Use RGB						Use RGB, ignore alpha
RGBA							Use RGB, alpha=1				Use RGBA

I believe that covers all the cases. This assumes that all incoming grayscale images are converted to RGB and alpha is only present if it was in the original source image (which is never for JPG). I think this is the only way we can reasonably support the 1 and 2 channel formats for incoming images.


You are currently subscribe to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email: