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 3 of 3

Thread: Vertex Array Objects (vao)

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2014
    Posts
    7

    Vertex Array Objects (vao)

    I am using OpenGL 4.3, Core:
    In the OpenGL Programming Guide, 8th, Pg120, they have this:

    for (i = 0; i < primcount; i++) {
    if (count[i] > 0)
    glDrawArrays(mode, first[i], count[i]);
    }

    This means many primitives ('primcount') are attached to one vao, right? Said, another way, there is one and only one bound vao. In the buffer bound to the vao, first[i] is the start offset & count[i] is the number of vertices. So, you just append each primitive's vertex position, color, normal, texture into a buffer sequentially? Keep track of the offset & number of vertices for each primitive and then use the loop.

    If this is wrong, and instead each primitive is associated with one vao, they would have to have this:
    for (i = 0; i < primcount; i++) {
    if (count[i] > 0)
    glBindVertexArray(vao[i]);
    glDrawArrays(mode, first[i], count[i]);
    }

    I was able to render the second loop successively but not the first loop.
    Any help is appreciated.
    Last edited by ITISAGLN; 02-22-2014 at 05:16 PM.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    I don't own OpenGL Programming Guide but draw calls only make sense if the matching vertex buffer is bound (via vao) prior to the call.

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2014
    Posts
    7
    Thanks for responding to my post. ok.
    Last edited by ITISAGLN; 02-24-2014 at 08:45 PM.

Posting Permissions

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