I am working on a little game (using OS X Lion, Xcode 4, Objective-C / C++, Cocoa, OpenGL). It's a rather simple concept. I've got some objects that move around inside a two-dimensional array. Now i want to write an OpenGL GUI for my game.
What i did was go through my array and draw a cube for each object inside it, at its specific position, with a texture that depends on the kind of object. Of course my first naive implementation was a bit CPU-intensive, so the next step was to implement a texture atlas. Since i've got a lot of vertices, there is still a lot of room for improvement.
I read that VBOs and DisplayLists are a lot faster. I worked through some tutorials, but i've still got a lot of questions about the implementation in a real dynamic game environment.
Say i compile me some display lists for my game-objects. If i want to place it at a specific position i'd have to glTranslatef(). But a lot of glTranslatef() can be very CPU-intensive. How do i deal with that? Of course i could create a display list for each kind of game-object at every possible position, but it seems impractical, and it would only work because my game is tile-based...
VBOs seem to suffer from the same problem. Of course (at least from my understanding) i could create a whole mesh of vertices, then go through my array and for every object render a cube of vertices associated with the objects position. But i don't get how i'd apply a texture to a specific cube from a whole mesh of vertices. Do i have to create texture coordinates for every cube face inside the mesh or would it be enough to create texture coordinate for all 6 faces of a cube?