Part of the Khronos Group

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 Object Rendering Questions

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member Newbie
    Join Date
    Sep 2012

    Vertex Array Object Rendering Questions

    Windows 7 - 64bit - GTS 450 (driver verions
    Open GL 4.2
    Learning Area: VAO usage

    1. What happens when you rebind the currently bound VAO with glBindVertexArray()? Is there a performance cost to rebinding the current VAO?
    (I have heard that there is a large performance cost to bind a different VAO [] but what about rebinding the same VAO).

    2. When drawing with glDraw*Range*BaseVertex(), should 'start' and 'end' be calculated with or without 'basevertex' taken into account?
    (spec [] doesn't seem to have information on this question).

    In short, does the documentation mean that Open GL adds 'basevertex' to the 'start' and 'end' indices or do I need to add 'basevertex' to 'start' and 'end' manually before calling glDraw*Range() to help the driver optimize glDraw*Range() calls?

    For example:
    Imagine that the indices from different meshes are combined, many of the indices will have the same value, but different meanings, which is solved by keeping a baseIndex with each mesh and using it to call gl*Draw*BaseVertex.
    Each mesh's index offset is saved so that multiple unrelated meshes can be rendered with one VAO.

    vertices = {0,0,0, 0,0,0, 0,0,0, 0,1,-2, -1,-1,-2, 1,-1,-2}
    indices = {0,1,2, 0,1,2 }
    // Assuming glBind(GL_ELEMENT_ARRAY_BUFFER, ...) is bound and the correct VAO is bound with correct enabled vertex attributes
    glDrawRangeElementsBaseVertex(GL_TRIANGLES, 0?, 2?, 3, GL_INT, NULL, 3); // Last parameter is 'basevertex'

    Should 'start' and 'end' be 0 and 2 or should they be 3 and 5 since those are the actual vertex indices that they are trying to refer to?
    Last edited by Teamworkguy2; 09-30-2012 at 09:02 PM. Reason: remove unneeded information

Tags for this Thread

Posting Permissions

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