What sort of differences in effect, purpose, performance, etc, are there between a uniform and a constant vertex attribute?
I read (OpenGL ES 2.0 Programming Guide, pp 102-103 and 108-110) that if you disable a vertex attribute, it uses the constant attribute, which you can set with glVertexAttrib4fv, etc. So how would it differ from setting it as a uniform?
For example, say I wanted to draw triangles with one constant color per triangle. I think I’d have to draw one triangle at a time, which I’d prefer not to do. But if I did, I could put the color in a uniform and use it from either shader. Or I could put it in a constant vertex attribute and use that from the vertex shader. (There’s one difference–I couldn’t get to the vertex attribute from the fragment shader.)
I know I could also duplicate the colors per vertex and draw all the triangles together, but I’m curious about the above options.
Is it quicker to set or access one or the other? Am I right that either way I’d have to draw one triangle at a time, changing the color each time?
thanks,
andy