Generic vertex attributes

Can anyone tell me how to access generic vertex attributes with the GLSL. The spec only mentions standard attributes.

// Get the attribute index for the
// monkey parameter
monkeyAttrib = glGetAttribLocationARB(myVertexProgram, “monkey”);

glVertexAttribPointerARB(monkeyAttrib, 1, GL_FLOAT, GL_FALSE, 1234, monkeyData);

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?

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!

You can tell GLSL which attrib index you want a given variable to have using glBindAttribLocationARB().

That’s useful. I should really RTFM at some point. I hadn’t realised 3DLabs’ documentation was so good. Thanks again.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.