title: Direct State access with vertex buffers
body: <p>Looking at <a href="https://stackoverflow.com/questions/3776726/how-to-bind-a-element-buffer-array-to-vertex-array-object-using-direct-state-a">this question from 2010</a>, concerning vertex buffers in modern OpenGL, is it still the case that Direct State Access is unavailable with them?  I've modified most of my graphics library to use DSA with framebuffer, texture and so on but I still need to "bind" to set my vertex array state (bind array, bind index buffer, bind vertex buffer, unbind array, etc.).</p>
  
  <p><strong>Update 1:</strong>  I had trouble understanding what the parameters do from BDL's answer.  My unit test for a very simple vertex buffer (one attribute, a position) gives me a blank screen (it worked fine with the old method of describing vertex streams). It's supposed to just draw a single triangle, no index buffers required.  </p>
  
  <p>Here's what I'm doing, the comments are my understanding:</p>
  
  <pre><code>        ::glEnableVertexArrayAttrib(vao,        // VAO name.
                                      0);         // Attribute index (layout in shader).
          ::glVertexArrayVertexBuffer(vao,        // VAO name.
                                      0,          // Binding point.
                                      vbo,        // VBO name.
                                      12,         // Stride (bytes).
                                      0);         // Offset (bytes).
          ::glVertexArrayAttribFormat(vao,        // VAO name.
                                      0,          // Attribute index (layout in shader).
                                      3,          // Component count (x,y,z).
                                      GL_FLOAT,   // Type.
                                      GL_FALSE,   // Normalised.
                                      0);         // Offset (bytes).
          ::glVertexArrayAttribBinding(vao,       // VAO name.
                                       0,         // Attribute index (layout in shader).
                                       0);        // Binding point.
  </code></pre>
  
  <p>Now, I think I "get it" about binding points.  They're an arbitrary number I can assign such that it's quick and easy for me to swap in a different set of attributes.  So just using 0 here for this simple test should suffice.</p>
  
  <p>I'm using glCreateBuffers to create the vbo and glCreateVertexArrays to create the vao (changed from the previous bindable style).  There's no debug output (debug context is on) and every call is checked with glGetError and there are no errors reported.</p>
  
  <p><strong>Update 2:</strong>  the glVertexArrayVertexBuffer stride and offset were in the wrong order.  It now works.</p>
  
  <p><strong>Update 3:</strong> glVertexArrayVertexBuffer is called once, not once for each attribute in the VBO (if you have interleaved position, texture and so on).</p>