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

Re: [Public WebGL] WebGLAttributeLocation instead of GLint?



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
cmarrin@apple.com




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