PDA

View Full Version : Optimizing simple game renderer



Anonymous Coward
01-26-2003, 01:10 PM
Hello, I'm here looking for some advice.

I finished the development of a little space arcade game and wanted to optimize the render of game entities. Right now I'm using immediate mode function calls to draw all the geometry (each ship is 200-300 polys).
I know using vertex arrays and display lists is recommended in this case. I'll implement some tests, but which one do you recommend me?

About display lists: the game needs to display 4-12 ships on screen, can all these ships be compiled into display lists? I know there is a limit for display lists, but when do I need to concern about that limit?

About Vertex Arrays: I have never implemented anything too complex with vertex arrays, so I don't know how to use them in practice. In this case, should each ship have its own vertex array, or should I build a vertex array with all the data that will be displayed.

Well, I hope you can give me some good recommendations...if you need some more info, just ask. Thank you.

jwatte
01-26-2003, 05:50 PM
12 display lists is no problem. I've used hundreds before running out on the implementations that seem to have limitations.

You'd probably want to create an abstraction for a mesh, which would be your geometry arrays and triangle lists for a specific instance (ship). Then set up state (texture, say), lock the array, and draw the lists. Do this for each ship model type. If you're on a software transform card, then you're probably better off sorting by mesh than by material, to reduce the amount of array locking you do.

Of course, given the counts you talk about, if you have a modern computer, neither vertex processing nor transfer nor method used will make much of a difference; you'll probably be solidly fill rate bound. However, if you're still targeting a Pentium II and a TNT-2 or Voodoo3, then these kinds of optimizations make sense.

HamsterofDeath
01-27-2003, 01:23 AM
there is a maximum number of display lists ?

MickeyMouse
01-27-2003, 01:26 AM
No, but http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/008002.html

Relic
01-27-2003, 04:56 AM
No, no. The limit is pow(2,32)-1 because the return value of glGenLists is of type GLuint and 0 is reserved.
But you reach an earlier limit in the virtual address space even when you only had one byte per list. (All on 32 bit systems.)