PDA

View Full Version : Drawing two identical shapes



MarcLS
10-07-2017, 05:55 PM
I am very new to OpenGL (and posting my questions). I've completed the Learn OpenGL Hello Triangle tutorial successfully. (It actually draws a rectangle at the end of the lesson).

If I wanted to draw two identical rectangles... Is it as simple as creating a seperate VAO and VB and then in rendering:

glUseProgram(shaderProgram);
glBindVertexArray(VAO_first_square);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
glBindVertexArray(VAO_second_square);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
glBindVertexArray(0);

??

I tried this and it now I only see the second rectangle.

MarcLS
10-07-2017, 06:56 PM
I fixed it all. Never mind