title: On Android with opengl-es, should I put all glVertexPointer data into one buffer?
body: <p>I have a scene that contains a bunch of objects, for example lets say it's a simple grid of tiles.  So there's a main "border" object, and then (<em>rows x columns</em>) cells.</p>
  
  <p>For simplicity, assume each cell is a simple four-segment line consisting of a four-node GL_LINE_LOOP.</p>
  
  <p>Currently, my frame rate is awefull, and it seems to sit in all the glVertexBuffer() calls that I'm making, as each cell has it's own set of vertices, so it's own call to glVertexPointer:</p>
  
  <pre><code>class MyModel extends Model {
    ...
    public void onDrawFrame(GL10 gl) {
      gl.glVertexPointer(0, GL10.GL_FLOAT, 0, mBuffer);
      gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, 4);
    }
  
  }
  </code></pre>
  
  <p>Should I instead track all of my distinct primitive models in a world super-object, and keep a copy of all the vertices in memory?  I could then perform a single glVertexPointer call at the start of each frame, and use offsets for the DrawArrays.</p>
  
  <pre><code>class MyModel extends Model {
  
    public MyModel() {
      // do something clever in parent Model class to track total verts
      this.offsetId = somethingFromSuper();
    }
  
    public void onDrawFrame(GL10 gl) {
      // super's vertices should all have been already sent to GL
      gl.glDrawArrays(GL10.GL_LINE_LOOP, this.offsetId, 4);
    }
  
  }
  </code></pre>