Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Drawing two identical shapes

  1. #1
    Newbie Newbie
    Join Date
    Oct 2017
    Posts
    2

    Drawing two identical shapes

    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.

  2. #2
    Newbie Newbie
    Join Date
    Oct 2017
    Posts
    2

    Never mind above question. I found a code error. Was rewriting part of the first!

    I fixed it all. Never mind

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •