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

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



On 2010-05-20 17:39, Cedric Vivier wrote:
On Thu, May 20, 2010 at 23:24, Tim Johansson<timj@opera.com> wrote:
In 6.2 :

"""
A call to framebufferTexture2D with a texture which has been loaded
with 0/NONE/DONT_CARE internalformat will generate an
INVALID_OPERATION error and leave the framebuffer's attachments
untouched.
Additionally, a call to copyTexImage2D or copyTexSubImage2D when
currently bound texture has been loaded with 0/NONE/DONT_CARE
internalformat will generate an INVALID_OPERATION error and leave the
target texture untouched.
"""

How would that sound?
That would fix the issue, but I don't think there is a need to limit calls
to copyTexImage2D as stated above, only limiting copyTexSubImage2D should be
enough.
According to ES doc for copyTexImage2D :
"""
internalformat must be chosen such that color buffer components can be
dropped during conversion to the internal format, but new components
cannot be added. For example, an RGB color buffer can be used to
create LUMINANCE or RGB textures, but not ALPHA, LUMINANCE_ALPHA or
RGBA textures.
"""

I think the case you pointed out with copyTexSubImage2D can also
happen here, if copyTexImage2D's target texture is "automatic" it
could be RGBA whereas RGB was necessary (and intended), no?


No, copyTexImage2D has an internal format parameter. It is similar to texImage2D and defines a new texture with a new internal format and size. That's why the format of the currently bound texture does not matter, it will be replaced anyway.


I also just realized that texSubImage2D will need to be modified. texSubImage2D currently fails if the format passed to it does not match the internal format of the texture to update. I guess we would have to either add support for format conversions (which is not in gl es) or block texSubImage2D for textures with no defined internal format too.

//Tim

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