I'm benchmarking some simple code for drawing using OpenGL.
In the following code, the number of indices being drawn is 4,644 (or 1,548 triangles per frame = @60fps 92,880 Triangles per second).
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, screenSize.width, screenSize.height, 0, 0, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnable(GL_TEXTURE_2D);
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(venomGLAttribute), ,drawingTexturedList.attrib[0].color);
glVertexPointer(2, GL_SHORT, sizeof(venomGLAttribute), &drawingTexturedList.attrib[0].pos[0]);
glTexCoordPointer(2, GL_FLOAT, sizeof(venomGLAttribute), &drawingTexturedList.attrib[0].UV[0]);
glDrawElements(GL_TRIANGLES, drawingTexturedList[cnt].currentIndice /*4644*/, GL_UNSIGNED_INT, drawingTexturedList[cnt].Indices);
This takes 100% of one of my CPU's. If I take out the call to glDrawElements but still perform all the other steps (geometry preperation, gl*Pointer setup) I see my CPU stay at ~3%.
Is this expected behaviour? The machine I'm running on has a GeForce 8800GTX and a Dual Core @ 2.66Ghz.
Using fps as a measurement (which isn't perfect I realise) and using gDEBugger to confirm my findings, rendering 27,904 triangles a frame in a single call to glDrawElements brings my frame rate down to ~35fps (or 977,640 triangles a second).
Is there a better way to pack my data than I'm doing or perhaps a better way to send the data than glDrawElements? I don't think using a VBO will help as the data being sent changes every frame.
Any idea's would be appreciated!