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

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

On Tue, May 18, 2010 at 11:03, 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.

100% agree.

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

Yeah, I also do not understand what is the need for this, I see two
common use cases :

A - if developer does not care/know about format and/or intended
usage, use internalFormat=gl.NONE and let WebGL implementation load
DOM image/elements into RGBA (or RGB) textures.

B - if developer does care about internal format for efficiency (e.g
some channel(s) won't ever be used in the shaders so it's better to
store in one of RGB/LUMINANCE/ALPHA in relation to the intended
texture usage : opaque texture, normal maps, alpha maps...); developer
can use the internal format most appropriate for intended texture
usage and let WebGL do the conversion efficiently.

What would knowledge of the source format offer ?
If developer/X3D/other-framewok knows the source format it cannot do
better than internalFormat=gl.NONE without knowing the intended usage
for the texture, if it knows the intended usage then he can use the
most appropriate format for intended usage directly.


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: