Hi, all! The docs say:
void glEnableVertexArrayAttrib(GLuint vaobj, GLuint index);
where index: Specifies the index of the generic vertex attribute to be enabled or disabled.
Which I do not understand. To put the question into context, I have:
#version 420 core
layout (location = 0) in vec4 position;
void main(void)
{
gl_Position = position;
}
const GLfloat positions[] =
{ 0.25, -0.25, 0.5, 1.0,
-0.25, -0.25, 0.5, 1.0,
0.25, 0.25, 0.5, 1.0 };
const GLuint binding_index = 0, attrib_index = 22;
const GLuint offset = 0, stride = sizeof(GLuint) * 4;
const GLuint size = 4, relative_offset = 0;
GLuint vao;
glCreateVertexArrays(1, &vao);
GLuint buffer;
glCreateBuffers(1, &buffer);
glNamedBufferStorage(buffer, 12 * sizeof(GLuint), &positions[0], NULL);
glVertexArrayVertexBuffer(vao, binding_index, buffer, offset, stride);
glVertexArrayAttribFormat(
vao, attrib_index, size, GL_FLOAT, GL_FALSE, relative_offset);
glVertexArrayAttribBinding(vao, attrib_index, binding_index);
const int generic_vertex_attribute = 0;
glEnableVertexArrayAttrib(vao, generic_vertex_attribute);
But how do I know generic_vertex_attribute to be 0? Otherwise, the triangle does not show. Also, binding_index also seems to have to be 0. Even if I change the (location = 0) part in the shader. But why? How exactly do these values relate to each other?