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

Re: [Public WebGL] Explicit unboxing for object identifiers



On Sun, Jan 8, 2012 at 2:18 PM, Glenn Maynard <glenn@zewt.org> wrote:
> Try:
>
> locations[[program,location]] = data;
>
> where program and location are the values you'd pass to getUniform.

I believe [program,location].toString() will result in the string
"[object WebGLProgram],[object WebGLUniformLocation]", as far as I
know. So you won't be able to use [program,location] as a unique key
in an object.

I'm currently using a trick like this to index by shader program...

    shaderProgram._glquery_id = shaderProgramCounter;
    ++shaderProgramCounter;
   locations[shaderProgram._glquery_id] = { uniforms: [...],
vertexAttributes: [...] };

...which works because you can only ever get a single instance of a
WebGLProgram by calling createProgram - there's no other way to
enumerate programs using the WebGL API.

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