Vertex Array Object Rendering Questions

Windows 7 - 64bit - GTS 450 (driver verions 8.17.12.9610)
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 [http://www.opengl.org/wiki/Vertex_Rendering] but what about rebinding the same VAO).

  2. When drawing with glDrawRangeBaseVertex(), should ‘start’ and ‘end’ be calculated with or without ‘basevertex’ taken into account?
    (spec [http://www.opengl.org/wiki/GLAPI/glDrawRangeElementsBaseVertex] 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 glDrawRange() to help the driver optimize glDrawRange() 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 glDrawBaseVertex.
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?

What happens when you rebind the currently bound VAO with glBindVertexArray()? Is there a performance cost to rebinding the current VAO?

There’s no way to know for certain. But I do know the cost of not rebinding the same VAO. That cost is 0. 0 is less than or equal to the cost of rebinding the VAO.

So don’t do it.

When drawing with glDrawRangeBaseVertex(), should ‘start’ and ‘end’ be calculated with or without ‘basevertex’ taken into account?

Allow me to quote from the page you linked to:

Emphasis added.

Thanks for the enlightenment on question one.
Sorry about question two, I was not thorough enough when reading that page.
Thank you so much for your time and experienced advice.