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

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




I think neither, though having the latter as a separate spec would be useful (ask the image what the format will be).  The issue this is trying to solve is that browsers tend to convert all input data to RGB/RGBA; so your nice 1-channel alpha mask TGA/PNG/whatever gets expanded out to RGB before you get to pass it to TexImage2D, and so you don't get to have nice 1-channel data any more.  The proposal just tries to fix that.

    - Vlad

----- "Gregg Tavares" <gman@google.com> wrote:
Is the suggestion to get this value from WebGL or from the IMG tag.

ctx.getTextureParameter(??)

or

img.sourceFormat???

If the former, from WebGL, then it really seems like a mis-match. In order to have created the texture in the first place you have to pass the format in. So you already know the format.  If it belongs anywhere it belongs on the img tag, not in WebGL.

Please don't go adding features to WebGL just to support a busted file format. I'm not dissing X3D but if it's using the format of the image to decide anything then it's doing it wrong. There is no valid mapping between image format and texture usage. Having written several game asset pipelines I know this only too well. Let's not propagate and encourage bad practices.



On Mon, May 17, 2010 at 5:57 PM, Vladimir Vukicevic <vladimir@mozilla.com> wrote:

----- "Kenneth Russell" <kbr@google.com> wrote:
On Fri, May 14, 2010 at 4:06 PM, Chris Marrin <cmarrin@apple.com> wrote:
>
> I would feel comfortable doing that if the browser implementors agree that this is information we can get from the HTML image element.

WebKit would currently always return RGBA as the internal format, or
perhaps RGB if we could determine that the original image has no alpha
channel. We might be able to improve the precision of this query over
time. Does this sound acceptable and/or useful?
We would do the same for now.  Would be straightforward to improve in the future.

    - Vlad