title: Most basic working vbo example
body: <p>I want to know the simplest method for using vbo's in OpenGL... I have tried running a few examples that work but are clouded with all other information thats making it really confusing me... at the moment this is what i have</p>
  
  <pre><code>GLuint vboId = 0;
  const int trisize = (m_tris.size()/2)*3;//m_tris is an index array for verts and normals
  GLfloat* vertices = new GLfloat[trisize];
  GLfloat* normals = new GLfloat[trisize];
  
  int j=0;
  for (int i=0; i&lt;m_tris.size(); i+=2) {
  
      normals[j] = m_normals[m_tris[i+1]*3];
      vertices[j++] = m_vertices[m_tris[i]*3];
      normals[j] = m_normals[m_tris[i+1]*3+1];
      vertices[j++] = m_vertices[m_tris[i]*3+1];
      normals[j] = m_normals[m_tris[i+1]*3+2];
      vertices[j++] = m_vertices[m_tris[i]*3+2];
  } //im pretty sure this loop is right as its what i used before to display mesh correctly without vbo's using glVertex3f
  
  glGenBuffersARB(1, &amp;vboId);
  glBindBufferARB(GL_ARRAY_BUFFER_ARB, vboId);
  glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(vertices)+sizeof(normals), 0, GL_STATIC_DRAW_ARB);
  glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(vertices), vertices);
  glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, sizeof(vertices), sizeof(normals), normals);
  
  glVertexPointer(sizeof(vertices), GL_FLOAT, 3, 0);
  glNormalPointer(GL_FLOAT, 3, (void*)sizeof(vertices));
  </code></pre>
  
  <p>in a render method i have</p>
  
  <pre><code>glDrawArrays(GL_TRIANGLES, 0, this-&gt;getTriNum()); //0 is the vboId?
  </code></pre>
  
  <p>also i have a method that runs once...</p>
  
  <pre><code>glEnableClientState(GL_VERTEX_ARRAY);
  glEnableClientState(GL_NORMAL_ARRAY);
  </code></pre>
  
  <p>when i try to run my code i get "EXC_BAD_ACCESS"</p>
  
  <p>any advice on what im doing wrong... or a very simple implementation of a vbo would be very helpful</p>