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

Re: [Public WebGL] glGetUniform



On Wed, May 19, 2010 at 10:51 AM, Benoit Jacob <bjacob@mozilla.com> wrote:
> Hi List,
>
> Disclaimer : complete newbie here.
>
> I have a question about glGetUniform.
>
> From section 5.14.10 "Uniforms and attributes":
>
> any getUniform(WebGLProgram program, WebGLUniformLocation location)
>
> In order to implement this, we need to be able to determine the base type of that variable (int or float). How to do this? The only GL function that I see returning that info is glGetActiveUniform, but it wants an 'index' parameter, not a 'location' parameter.
>
> If this is not possible, should the spec be edited to have getUniformiv and getUniformfv functions like in OpenGL ES?

It's a two-step process. First you need to iterate all of the active
uniforms for the current program. For each you then need to call
glGetUniformLocation and see whether the location is equal to that
passed in the WebGLUniformLocation object. See
http://trac.webkit.org/browser/trunk/WebCore/html/canvas/WebGLRenderingContext.cpp#L1355
. This can be made more efficient with caches but since OpenGL get
calls aren't designed to be efficient it's a reasonable start.

-Ken

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