I'm a newbie to OpenGL and I was following a series by thebennybox on Youtube. Specifically his series on modern opengl programming. I thought I would try to implement his Mesh wrapper using the vector in C++ rather than using arrays of data and passing that to OpenGL. It works, but I cant' seem to render multiple meshes?Am I making an obvious mistake somewhere?This is I do to setup my mesh:glGenVertexArrays(1, &vao);glBindVertexArray(vao);glGenBuffers(BUFFER_COUNT, vbo);// vertices bufferglBindBuffer(GL_ARRAY_BUFFER, vbo[BUFFER_POSITION]);glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(positions.front()), &positions.front(), GL_STATIC_DRAW);glEnableVertexAttribArray(0);glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);// texture bufferglBindBuffer(GL_ARRAY_BUFFER, vbo[BUFFER_TEXCOORD]);glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(texes.front()), &texes.front(), GL_STATIC_DRAW);glEnableVertexAttribArray(1);glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, 0);// index bufferglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vbo[BUFFER_INDEX]);glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(indices.front()), &indices.front(), GL_STATIC_DRAW);glBindVertexArray(0);Then to render it I bind the VAO and draw the elements:glBindVertexArray(vao);glDrawElementsBaseVertex(GL_TRIANGLES, indices.size(), GL_UNSIGNED_INT, 0, 0);glBindVertexArray(0);And finally I can send it some data:std::vector<Vertex> vertices = {    Vertex(glm::vec3(0, 0, 0), glm::vec2(0, 0)),    Vertex(glm::vec3(0, 1, 0), glm::vec2(1, 0)),    Vertex(glm::vec3(0, 1, 1), glm::vec2(1, 1)),    Vertex(glm::vec3(0, 0, 1), glm::vec2(0, 1)),};std::vector<unsigned int> indices = {    0, 1, 2, 2, 3, 0};shape = new Mesh(vertices, indices);The weird thing is that this works perfectly, but as soon as I try render another mesh it wont render the previous mesh. The weird thing is that say I had mesh A and mesh B. I can render mesh A, then I setup mesh B, and even if I don't render it, nothing renders at all. Not even mesh A. I assume this is due to the state-based-ness of OpenGL.
Can't render multiple VAO's?
opengl