I'm the process of converting some opengl code to DSA and everywhere its written not to bind the vertex array, because its inherit in DSA. So I use
GLuint VBO, VAO, indexBuffer;
glCreateVertexArrays(1, &VAO);
glCreateBuffers(1, &indexBuffer);
glCreateBuffers(1, &VBO);
...
instead of the glGen... counterparts.
But now I just wonder whether there is a DSA version of binding the vertex arrays in the update loop. Now I have
while (!glfwWindowShouldClose(window)) {
glfwPollEvents();
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
// Draw the triangle
ourShader.Use();
const auto Textureloc = glGetUniformLocation(ourShader.Program, "ourTexture");
glBindTextureUnit(Textureloc, texture);
glBindVertexArray(VAO);
glDrawElements(GL_TRIANGLES, 9, GL_UNSIGNED_INT, 0);
glBindVertexArray(0);
glBindTextureUnit(0, 0);
glfwSwapBuffers(window);
}
which works all right. But will I run into some interesting problems later in my coding if I don't replace the glBindVertexArray
to something else. Just as I replaced glBindTexture
with glBindTextureUnit