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

Re: [Public WebGL] Issue with Uniform[1,2,3,4][i,f][v], etc...

On Tue, May 4, 2010 at 4:26 PM, Gregg Tavares <gman@google.com> wrote:
> I just ran over something I didn't know.  From the OpenGL ES 2.0 spec
> Section 2.10.4
> If the value of location is -1, the Uniform* commands will silently ignore
> the
> data passed in, and the current uniform values will not be changed.
> That probably means ctx.uniform1f(location, value) and all the related
> functions should silently do nothing if location == null
> That way, like OpenGL, the following WebGL code will work
> var location = ctx.getUniformLocation("someUniformTheDoesNotExist");
> ctx.glUniform1f(location, 1.0);  // silently does nothing.
> Currently I think most implementations are failing that example.
> It seems like the WebGL spec should probably mention this.

I didn't know that either. The OpenGL rule makes a lot of sense for
applications that try to look up a bunch of uniforms by name, where
some might not exist in a given shader or might have been optimized
away by the GLSL compiler. We've already seen a few instances of WebGL
content that would have benefitted from allowing a null
WebGLUniformLocation to be passed in without generating an error. I've
updated the text for the uniform* entry points in the WebGL spec to
specify this behavior.


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: