When I try to bind an attribute to an index of 0, the shader program fails at linking and the only information the in开发者_如何转开发folog gives is:
Vertex shader(s) failed to link, Fragment shader(s) linked.
According the the opengl docs
This command makes it possible for vertex shaders to use descriptive names for attribute variables rather than generic variables that are numbered from 0 to GL_MAX_VERTEX_ATTRIBS -1.
So binding an attribute to index 0 should work. Though it is not very important, I am curious as to why I cannot bind an attribute to index 0. Any suggestions are welcome.
Quoting OP commentary, because it saved me:
I found the problem(this was causing other problems): in my vertex shader I had switched from using gl_Vertex to using my own attribute, "vertex", but at one place in my shader I had forgotten to change the variable name, and since gl_Vertex uses the 0 index...
精彩评论