I'm using OpenGL ES on Android to draw some shapes, so I have some Model classes to load the vertices etc from an .obj file.
Each model then has a onDrawFrame() method which is called by the Renderer to place it in the scene.
public void onDrawFrame(GL10 gl) {
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glEnable(GL10.GL_CULL_FACE);
gl.glFrontFace(GL10.GL_CCW);
gl.glCullFace(GL10.GL_BACK);
gl.glVertexPointer(0, GL10.GL_FLOAT, 0, mVerts);
gl.glDrawElements(GL10.GL_TRIANGLES, mFaces.capacity(), GL10.GL_UNSIGNED_BYTE, mFaces);
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
}
My confusion now is where to "reset" the vertex pointer (I think), because if I try to create an arbitrary line from a new glVertexPointer using 2 new verts, and a call to glDrawElements(GL_LINES) using those id's, the line always seems to use verts 0 and 1 from the original data.
Do I need to pre-define all my scene's verts in one master glVertexPointer tracked by the master scene somehow, and have each model just call glDrawElements with a suitable offset? Or do I clear the pointer somehow?