scyth3s's picture

Faces, vertices, OpenGL, and Performance

I'm not really asking a specific question here, just trying to get a better idea of a few things. First of all, I downloaded a plane model with 17,561 faces (9,367 vertices) all of which were triangles. The model draws (without textures, but with lighting) all fine and dandy at a healthy FPS. When I draw it in a 10x for loop, the frame rate slows to "noticeably laggy," bringing up several questions in me.

How many vertices and faces are usually contained in a level?
What can I expect a good number of faces to be if I were attempting to release a game for a level?
How many faces do most characters (enemies, main character, etc) have?
Should I convert to VBO's from the display lists that I am currently using?
Will I have to optimize my program because this is really a miniscule amount of vertices? Or is it more vertices than I'll need in most levels?

I'd hope some folks here can shed light on some of my questions and thoughts. Oh no! My inexperience is showing!


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
tksuoran's picture

10k or 20k is a low number of vertices for today's computers. You can probably run that much with good fps on a mobile device if it has good hardware acceleration. On a desktop computer you should be able to use significantly more.

It is not the number of vertices or faces that matters most. The number of drawcalls matter, so you should minimise state changes and avoid all redundant GL calls. Batch content so that you can draw more with one draw call. Disable blending for opaque objects, and render them in front to back order. Use VBOs, reorder vertices / indices to cache friendly order (I used NVTriStrip long time ago). Always use mipmaps with textures, except for pixel perfect 2D content such as fonts. Use at least basic viewfrustum culling with bounding boxes or spheres. Consider level of detail optimisations for geometry and materials.

Make sure you have hardware acceleration enabled. What hardware and OS are you using?

In general display lists are quite fast, but remember to compile them only once. They are also deprecated and not available on OpenGL ES. So using cache optimised VBOs is preferred.