[Public WebGL] WebGLAttributeLocation instead of GLint?

Chris Marrin [email protected]
Mon Jan 4 08:15:58 PST 2010


On Jan 3, 2010, at 7:11 AM, Hao Nguyen wrote:

> I think it would be more intuitive to have vertex attribute index to
> be an interface like WebGLAttributeLocation (similar to
> WebGLUniformLocation) rather than using an GLint. After all, we are
> not modifying the value of that integer anyway. Then, we can get rid
> of bindAttribLocation(), and have the context implementation binds a
> unique index to an attribute variable when getAttribLocation() is
> called for the first time.


The reason we didn't do this is because uniform location and attrib indexes are fundamentally different. Uniforms live in the Program object and are accessed using abstract tokens generated by the Program itself. Attributes live in the OpenGL state and really are accessed using numeric indexes. So, for instance, you can ask for index+1 and get the next attribute location in the state. But you can't ask for location+1 and have it be meaningful. In fact, we created WebGLUniformLocation to avoid authors creating a bad access by using location ids not generated by the program object.

-----
~Chris
[email protected]




-----------------------------------------------------------
You are currently subscribe to [email protected]
To unsubscribe, send an email to [email protected] with
the following command in the body of your email:




More information about the public_webgl mailing list