Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Does glBindAttribLocation silently ignore names that are not found? For example, in a shader:

// Some vertex shader
in vec3 position;
in vec3 normal;
// ...

And in some set up code:

// While setting up shader
GLuint program = glCreateProgram();
glBindAttribLocation(program, 0, "position");
glBindAttribLocation(program, 1, "normal");
glBindAttribLocation(program, 2, "color"); // What about this one?
glLinkProgram(program);
share|improve this question
    
You can collect OpenGL errors and see what's silent and what's not. –  Byte56 Jun 25 '13 at 15:35

1 Answer 1

up vote 2 down vote accepted

I did a test for that and the short answer is openGL didn't return any error.

OpenGL documentation also states:

glBindAttribLocation can be called before any vertex shader objects are bound to the specified program object. It is also permissible to bind a generic attribute index to an attribute variable name that is never used in a vertex shader.

If name was bound previously, that information is lost. Thus you cannot bind one user-defined attribute variable to multiple indices, but you can bind multiple user-defined attribute variables to the same index.

share|improve this answer
    
Thanks for pointing out. I completely missed that sentence. –  rwols Jun 26 '13 at 1:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.