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 (rows x columns) cells.
For simplicity, assume each cell is a simple four-segment line consisting of a four-node GL_LINE_LOOP.
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:
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);
}
}
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.
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);
}
}