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

Re: [Public WebGL] Adding internalformat param to all texImage2d variants



Hi Crhis,

thank you and everyone involved in this effort!

As far as the X3D/X3DOM relevance goes:

This proposal would certainly help to control the final format but 
we still would need more information about the original format.

How should we know if there where RGB-channels in the original format or not?

Remember: We do not have a controlled data-preparation step or process
with X3DOM based application. All we get inside of the X3D-stream is 
a reference to the external image-data. No additional information on the 
format is provided inside of the XML-stream. 

But, according to the X3D-spec, we must shade the geometry differently
depending on the channel-setup of the image (wise or not):

One example:

If we have an A, L or LA image we use the diffuseColor from the material-node
If we have a RGB or RGBA the diffuseColor is not modulated.

http://x3dom.org/x3dom/example/x3dom_imageChannels.xhtml

This can be easily done during runtime as part of your standard-shader
but we just have to know it upfront.

best regards
johannes

On 12 May 2010, at 20:08, Chris Marrin wrote:

> 
> In this thread:
> 
> 	http://www.khronos.org/webgl/public-mailing-list/archives/1002/msg00081.html
> 
> 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.
> 
> Comments?
> 
> -----
> ~Chris
> cmarrin@apple.com
> 
> 
> 
> 
> 
> -----------------------------------------------------------
> 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:
> 

--
Dr. Johannes Behr
Leiter Projektbereich VR

Fraunhofer-Institut für Graphische Datenverarbeitung IGD
Fraunhoferstr. 5  |  64283 Darmstadt  |  Germany
Tel +49 6151 155-510  |  Fax +49 6151 155-196
johannes.behr@igd.fraunhofer.de  |  www.igd.fraunhofer.de


-----------------------------------------------------------
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: