My game draws a series of cubes from a VBO, and just translates to the cube's position each time:
...
SetCameraMatrix();
SetFrustum();
//start vbo rendering
glEnableClientState(GL_VERTEX_ARRAY);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 1);
glVertexPointer(3, GL_FLOAT, 0, 0);
glColor3f(1,0.5,0);
for(int i = 0; i < collids.size(); ++i)
{
glColor3f(collids[i]->Color.x,collids[i]->Color.y,collids[i]->Color.z);
collids[i]->render();
}
//end vbo rendering
glDisableClientState(GL_VERTEX_ARRAY); // disable vertex arrays
glBindBufferARB(GL_ARRAY_BUFFER_ARB,0);
...
the render() is this:
void CBox::render()
{
glPushMatrix();
glTranslatef(center.x,center.y,center.z);
glDrawArrays(GL_QUADS, 0, 24);
glPopMatrix();
}
Is there a way I could optimize this? Since i'm always drawing the same thing, what could I do to make this less cpu intensive? Thanks