GLuint VertexArrayID;
glGenVertexArrays(1, &VertexArrayID);
glBindVertexArray(VertexArrayID);
As you can see from the above code, some tutorials use this before using opengl. But a tutorial that I am following, directly uses glGenBuffers
method and it works just fine. Hence I am totally confused what glGenVertexArrays
. It is sad that it defines how buffer is used, but noone says in what way. Can you help me understand ?
It depends on the OpenGL version. Beginning with the OpenGL-3 core profiles having a VAO is mandatory. To stay compatible with older code most developers just throw in the snippet you found there at the beginning to have a VAO lying around to catch all the VBO state.