in my shaders I like to use a syntax like this:
layout (location = 0) in vec3 aPos;
So that I can just use the index 0
in glVertexAttribPointer
and the such, saving the effort for the glGetAttribLocation
call. I'd like to do the same with uniform
values, but if I do
layout (location = 2) uniform float offset;
My vertex shader fails to compile. Is there any way to achieve the same behavior and not use glGetUniformLocation
?