title: VBOs with std::vector
body: <p>I've written a model loader in C++ an OpenGL. I've used <code>std::vector</code>s to store my vertex data, but now I want to pass it to <code>glBufferData()</code>, however the data types are wildly different. I want to know if there's a way to convert between <code>std::vector</code> to the documented <code>const GLvoid *</code> for <code>glBufferData()</code>.</p>
  
  <h3>Vertex type</h3>
  
  <pre><code>typedef struct
  {
      float x, y, z;
      float nx, ny, nz;
      float u, v;
  }
  Vertex;
  
  vector&lt;Vertex&gt; vertices;
  </code></pre>
  
  <h3>glBufferData() call</h3>
  
  <pre><code>glBufferData(GL_ARRAY_BUFFER, vertices.size() * 3 * sizeof(float), vertices, GL_STATIC_DRAW);
  </code></pre>
  
  <p>I get the following (expected) error:</p>
  
  <pre><code>error: cannot convert ‘std::vector&lt;Vertex&gt;’ to ‘const GLvoid*’ in argument passing
  </code></pre>
  
  <p>How can I convert the vector to a type compatible with <code>glBufferData()</code>?</p>
  
  <p><em>NB. I don't care about correct memory allocation at the moment; <code>vertices.size() * 3 * sizeof(float)</code> will most likely segfault, but I want to solve the type error first.</em></p>