title: Drawing VBO causes segmentation fault
body: <p>I am trying to draw a quad using a VBO, <a href="http://pastebin.com/cgjPKqhb" rel="nofollow">here is the full code</a> but I'll post the code step by step: here is how I initialize the buffer:  </p>
  
  <pre><code>data= vector&lt;GLfloat&gt; {  // Global variable vector&lt;GLfloat&gt; data;
  // Viewport: glViewport(0,0,width,height);
      width/2+20,height/2+20,0.0,
      width/2+20,height/2-20,0.0,
      width/2-20, height/2-20,0.0,
      width/2-20, height/2+20,0.0
  };
  glGenBuffers(1, &amp;buffer);
  glBindBuffer(GL_ARRAY_BUFFER, buffer);
  glBufferData(GL_ARRAY_BUFFER, 12*sizeof(GLfloat), data.data(), GL_STATIC_DRAW);
  glBindBuffer(GL_ARRAY_BUFFER, 0);
  </code></pre>
  
  <p>Then in the display function I try to draw the quad (I use double buffering):   </p>
  
  <pre><code>glClearColor(1.0, 1.0, 1.0, 1.0);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  
  glColor3f(1, 0, 0);
  glBindBuffer(GL_ARRAY_BUFFER, buffer);
  glEnableClientState(GL_VERTEX_ARRAY);
  glVertexPointer(3, GL_FLOAT, 0, data.data());
  glDrawArrays(GL_QUADS, 0, 4); // Here I get segmentation fault
  glDisableClientState(GL_VERTEX_ARRAY);
  glBindBuffer(GL_ARRAY_BUFFER, 0);
  
  glutSwapBuffers();
  </code></pre>
  
  <p>I get segmentation fault at the line where I call <code>glDrawArrays</code>, I also tried to get the OpenGL errors with <code>glGetError()</code>, but there's no error (it returns zero).</p>