I am attempting to convert some code from OpenGL 4.4 to OpenGL 4.5. Here is the old code which uses the DSA extension:
GLuint vao = 0;
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffers[2]);
glEnableVertexArrayAttribEXT(vao, 0);
glEnableVertexArrayAttribEXT(vao, 1);
glVertexArrayVertexAttribOffsetEXT(vao, buffers[0], 0, 3, GL_FLOAT, GL_FALSE, 0, 0);
glVertexArrayVertexAttribOffsetEXT(vao, buffers[1], 1, 2, GL_FLOAT, GL_FALSE, 0, 0);
Here is the new code which uses core DSA:
GLuint vao = 0;
glCreateVertexArrays(1, &vao);
glVertexArrayElementBuffer(vao, buffers[2]);
glEnableVertexArrayAttrib(vao, 0);
glEnableVertexArrayAttrib(vao, 1);
glVertexArrayVertexBuffer(vao, 0, buffers[0], 0, 0);
glVertexArrayVertexBuffer(vao, 1, buffers[1], 0, 0);
glVertexArrayAttribFormat(vao, 0, 3, GL_FLOAT, GL_FALSE, 0);
glVertexArrayAttribFormat(vao, 1, 2, GL_FLOAT, GL_FALSE, 0);
This code does not work and I am not sure why. Nothing is rendered and no errors or debug output is generated.
Second question: Is the relativeoffset of glVertexArrayAttribLFormat identical to the stride of glVertexArrayVertexBuffer? It seems odd to have to specify the same exact thing twice in a row.