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

Re: [Public WebGL] Initial textures

I think the behavior (and WebGL in general) should match with OpenGL ES 2.0 since it is a _javascript_ language binding of that API.


On Thu, May 6, 2010 at 6:11 PM, Kenneth Russell <kbr@google.com> wrote:
Gregg Tavares raised the point that OpenGL and OpenGL ES 2.0 have the
notion of an initial texture object bound to the TEXTURE_2D and
TEXTURE_CUBE_MAP binding points. If one calls
glBindTexture(GL_TEXTURE_2D, 0) and then glTexImage2D(GL_TEXTURE_2D,
...), the call does not generate an error; instead, this initial
texture is mutated.

WebGL currently specifies that all of the entry points which mutate a
texture generate an INVALID_OPERATION error if no WebGLTexture object
is bound; in other words, if bindTexture(TEXTURE_2D, null) has been
called or if bindTexture has never been called with a non-null
WebGLTexture object.

I recall that the current behavior was decided upon early in the
development of the specification because of a feeling that support for
the initial texture in OpenGL is historical, predating the
introduction of texture objects. Gregg points out that it is very
useful. One can change the default texture to purple, and then
anywhere in the application where the developer forgot to properly
bind a texture, the scene will be drawn in purple. Currently there is
no way to change the contents of the initial texture in WebGL, but it
can be sampled by shaders.

It seems to me that we should change the WebGL spec to match the
OpenGL behavior; remove the constraint that binding null to TEXTURE_2D
or TEXTURE_CUBE_MAP causes subsequent operations that change the
texture to fail, and reference the OpenGL ES 2.0 behavior regarding
the initial texture.


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: