title: Insert data in Vertex Buffer Object
body: <p>I´m creating a template class in order to initialize a VBO and fill it with different kind of data, i.e. 2d vectors, 3d vectors, indices and so on.
  Values are passed to the class constructor in a std:vector and then, as far as I know, all of them must be concatenated in a array of floats to push them into the VBO.</p>
  
  <p>Lets say I have a 3d vector class like this:</p>
  
  <pre><code>class Vector3
  {
  public:
      GLfloat* Values;
  
  
  public:
      Vector3(GLfloat x, GLfloat y, GLfloat z)
      {
          Values = new GLfloat[3];
          Values[0] = x;
          Values[1] = y;
          Values[2] = z;
  
      }
  
      ~Vector3() { delete Values}
  
      static int Size() { return 3; };
  
      ...
  };
  </code></pre>
  
  <p>And then the template class with this constructor</p>
  
  <pre><code>template &lt;class T1&gt; class VBO
  {
  public:
      VBO(std::vector&lt;T1*&gt; v_array)
      {
  
          int s = T1::Size();
          GLfloat *map = new GLfloat[v_array.size() * s];
  
          int pos = -s;
          for (std::vector&lt;T1*&gt;::iterator it = v_array.begin(); it != v_array.end(); ++it)
              std::copy((*it)-&gt;Values, (*it)-&gt;Values + s, map + (pos += s));
  
          ...
  
      }
  };
  </code></pre>
  
  <p>Now I can use 'map' to push data in the VBO using glBufferData</p>
  
  <p>My question is. Is there a better way to do this? Say, is it possible to push std::vector v_array directly in the VBO?</p>