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.

  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.

Similar Threads

  1. Usage of Vertex Array Objects
    By Remco Poelstra in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 10-07-2014, 06:58 AM
  2. Vertex Arrays, Buffer Objects, and Vertex Array Objects
    By dcox1776 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 10-09-2012, 02:26 AM
  3. Vertex Arrays vs Vertex Array Objects vs Buffer Objects
    By dcox1776 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-05-2012, 06:10 AM
  4. Vertex array's for creating objects.
    By nexusone in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 02-01-2002, 09:38 AM
  5. Vertex Array Objects
    By Lucretia in forum OpenGL: General
    Replies: 1
    Last Post: 10-23-2000, 01:24 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
  •  
Proudly hosted by Digital Ocean