So, back to optimizing OpenGL drawing. I did some really quick manual benchmarks with the 50x50 map, so about 5,000 triangles with 15,000 unique vertices:
20FPS with fullscreen fill, but only a small fraction of the tris are visible <--- most common usage scenario 17FPS with fullscreen fill, about half tris are visible 19FPS with halfscreen fill, all tris visible 40FPS with noscreen fill, no tris visible I'm not sure why I didn't see this before, but that last benchmark is alarming. Basically, just the act of sending 5k triangles and culling them reduces me from 60 to 40FPS! Clearly, there is a penalty for drawing stuff that won't show up. So maybe doing my own culling will help after all. But I did try this before, so I'm not sure...I'll have to try it again - I was probably using different parameters and what not. Other things to try:
- Using TRIANGLE_STRIP instead of TRIANGLES (unlikely to make a difference)
- glDrawTex (can't see this being fast at all...)
- Toggling alpha blend/test
- Tightening quads to avoid 0-alpha fragments (definitely must do this)
- Spatial partitioning to avoid sending off-screen sprites
- Texture compression
No comments:
Post a Comment