1
\$\begingroup\$

From everything I've researched, Vertex Array Objects (VAOs) are essentially just a trick, based on the fact that OpenGL keeps some kind of internal stack, so that when you bind the VAO, which otherwise you don't use at all for its own sake, everything you bind afterwards can be "re-bound" by simply rebinding the VAO, yet this is not an inherent feature of Vertex Arrays, but just a way to "hack" OpenGL to make fewer bind calls. Is this the right understanding?

\$\endgroup\$
2
  • 1
    \$\begingroup\$ yet this is not an inherent feature of X, but just a way to "hack" Y - that can be said just about anything. "Subtraction is not an inherent feature of Numbers, it's just a way to hack Math." :-) \$\endgroup\$ Commented Jun 27 at 6:36
  • \$\begingroup\$ How would the API need to look / work for you to deem it as not just a "hack"? Contrasting against this expectation can be a good way to help a reader understand your mental model here. \$\endgroup\$ Commented Jun 27 at 11:28

1 Answer 1

3
\$\begingroup\$

That is one way to look at VAOs.

However It's more than "just a trick".

If the user code properly uses VAOs to cache the vertex bindings then the driver can skip some of the work involved when starting a draw with a different set of vertex buffers. Some of that work being verification that vertex data is all present and (in some gpus) recompiling the vertex shader to programmatically pull in that data.

However YMMV on the benefit of that.

A better way to achieve that kind of bonus is by only rebinding the vertex buffer without affecting the vertex layout. Then the change needed between draws is only a vram pointer per buffer used. This is available in 4.3 using the glVertexAttribFormat set of calls.

\$\endgroup\$
1
  • \$\begingroup\$ So you're saying this is actually the purpose and intended use of VAOs? \$\endgroup\$ Commented Jun 27 at 16:24

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.