Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A VAO <em>doesn't</em> hold <em>any</em> vertex attribute <em>data</em>. It's a container object for a set of <em>vertex arrays</em> which describe how to pull data from zero, one or multiple buffer objects (these are the actual vertex arrays you define with <code>VertexAtrribPointer()</code>(pre-GL43) or <code>VertexAttribFormat()</code>, <code>VertexAttribBinding()</code> and <code>BindVertexBuffer()</code> (GL43+)), enable states for said vertex arrays and possibly an <code>ELEMENT_ARRAY_BUFFER_BINDING</code>. See tables 23.3 and 23.4 of the GL 4.4 core specification for details. </p> <p>The <code>ARRAY_BUFFER_BINDING</code> is recorded separately for <em>each</em> vertex array, i.e. each <code>VertexAttribPointer()</code> invocation per attribute index. This way you can associate a an attribute index of the VAO with multiple buffer objects and switch between which buffers to pull from using <code>{Enable|Disable}VertexAttribArray()</code> or by distributing buffers across attrib indices and choosing appropriate attrib locations for your shaders - either with <code>glBindAttribLocation()</code> or using explicit attrib locations inside your shader (the latter is superior).</p> <p>Why all this blabbering about VAOs? Because there is no detrimental effect of using VAOs and the layout of a VBOs buffer store and how quickly vertices are pulled has nothing to do with VAOs. VAOs are state containers, nothing more, nothing less. You still need buffer storage to back any vertex pulling, you can interleave your data just like you did without VAOs. All you need to do is reflect the interleaved memory layout with your vertex arrays. So in essence, except for recording vertex array state, nothing changes. </p> <p>What you gain by using VAOs is a way to more or less quickly switch between sets of state and associated buffer objects without setting up vertex arrays everytime you switch a buffer object. You therefore save API calls. Also, when binding a VAO, each vertex array still has its <code>ARRAY_BUFFER_BINDING</code> and there is no need to call <code>BindBuffer()</code> again thus saving further API calls. That's it. </p> <p>You don't gain nor do you lose <em>anything</em> in regards to vertex pulling performance because of a VAO, at least not in theory. You do, however, lose overall performance when you inconsiderately switch VAOs around like crazy.</p> <p>BTW, using VAOs is also mandatory when using GL32 and higher core contexts so your question is moot if you're not going for compat.</p> <p>In general, when you're unsure about performance: don't guess, always profile! That's especially true when using OpenGL. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload