title: how to convert OpenGL code using vertex arrays into code using vertex buffer objects?
body: <p>this is my <code>draw()</code> function written in C, using vertex arrays:</p>
  
  <pre><code>void draw(float x1, float x2, float y1, float y2)
  {
      glPushMatrix(); 
  
      glScalef(1.0 / (x2 - x1), 1.0 / (y2 - y1), 1.0);
      glTranslatef(-x1, -y1, 0.0);
      glColor3f(1.0, 1.0, 1.0);
  
      if( pts.size &gt; 0 )
      {
          glEnableClientState( GL_VERTEX_ARRAY );
          glVertexPointer( 2, GL_FLOAT, 0, (float*)pts.data );
          glDrawArrays( GL_LINE_STRIP, 0, pts.size / 2 );
          glDisableClientState( GL_VERTEX_ARRAY );
      }
  
      glPopMatrix();
  };
  </code></pre>
  
  <p>before calling <code>draw()</code>, <code>pts</code> get's updated inside the <code>update()</code> function:</p>
  
  <pre><code>void update(double (* func)(double x), float x1, float x2, int N)
  {
      double x, dx = (double)1.0/(double)N;
      vector_cleanup( &amp;pts );
      m = 0;
      for(x = x1; x &lt; x2; x += dx)
      {
          vector_resize( &amp;pts, pts.size + 2 );
          *(float*)vector_get( &amp;pts, pts.size-2 ) = (float)x;
          *(float*)vector_get( &amp;pts, pts.size-1 ) = (float)func3(x);
          m++;
      }
  }
  </code></pre>
  
  <p>I hope that by converting this code to use VBO, my graphics performance will increase.</p>
  
  <p><strong>EDIT:</strong> <code>func3()</code> can be anything, e.g. <code>sin(x)</code> or just some linear mapping. All I'm currently trying to do is, to find out how quickly I can plot a bunch of points.</p>