So for attributes the spacing between indexes is vec4, so if I had 2 matrix as an attribute, they'd be layout (location = 0) in mat4 a and layout (location = 4) in mat4 b

If I did the same for 2 uniform matix, what would the index of matrix b be?

Side note: with OpenGL 4, are VBOs also attributes, there isn't a key word for vertex?


Uniform locations don't work like attribute locations.

Every basic type in OpenGL takes up 1 uniform location. So a float and a mat4 both take up 1 location. The only time multiple locations are consumed is if you're using an aggregate (aka: struct or array) of basic types. Each basic type element of the aggregate, recursively, takes up one location.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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