View Full Version : Generic vertex attributes

02-06-2004, 07:51 AM
Can anyone tell me how to access generic vertex attributes with the GLSL. The spec only mentions standard attributes.

02-06-2004, 08:04 AM
// Get the attribute index for the
// monkey parameter
monkeyAttrib = glGetAttribLocationARB(myVertexProgram, "monkey");

glVertexAttribPointerARB(monkeyAttrib, 1, GL_FLOAT, GL_FALSE, 1234, monkeyData);
http://www.3dlabs.com/support/developer/ogl2/slapi/GetAttribLocationARB.htm http://www.3dlabs.com/support/developer/ogl2/slapi/VertexAttribPointerARB.htm

02-06-2004, 08:08 AM
I understand how to set generic attributes. I just don't know how to get at them from within a vertex shader.

For example, to get the normal, I can use gl_Normal, but how do I get attribute 6?

02-06-2004, 08:11 AM
Scratch that. I see what you mean. There's no way to access a specific attrib because the GLSL determines the number for me. Thanks!

02-06-2004, 11:19 AM
You can tell GLSL which attrib index you want a given variable to have using glBindAttribLocationARB().


02-06-2004, 02:05 PM
That's useful. I should really RTFM at some point. I hadn't realised 3DLabs' documentation was so good. Thanks again.