Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding the bottleneck in a OpenGL application on the iphone

I'm trying to track down the bottleneck in an IPhone OpenGL game I'm writing. The game itself is in 2d, and contains a couple hundred textured sprites, each alpha blended.

In terms of textures, I only use a single 512x512 atlas that I bind once, so I don't think its a bandwidth issue (at least not from the upload of textures).

I used instruments to track the CPU usage, memory usage and OpenGL ES usage. At a heavy point in the game, I was getting seeing the following:

FPS: 20 CPU: 60% Real Mem: 17Mb Tiler utilisation : 21% Rendered utilisation : 45%

I'm a little confused as to what could be the bottleneck? How high can the CPU usage go (I'm aware that there are other applications running at the same time) before it becomes the bottleneck? Does 60% sound about right?

Or could it be the amount of graphics? I'm guessing not if the tiler + renderer utilisation are that low down. But I must confess I'm not expert in reading these results.

Any pointers on either what my likely bottleneck is, or where else to look for one would be gratefully received!

like image 630
Oliver Hume Avatar asked Dec 30 '22 04:12

Oliver Hume


2 Answers

The CPU sounds a bit high, are you using a lot of trigonometric functions like sin/cos? Sometimes those are used badly, ie for particle-systems. Try to keep them to a minimum or if possible use a lookup-table instead.

Here is a good discussion for approximations

like image 53
epatel Avatar answered Jan 18 '23 23:01

epatel


If you haven't already, read through Optimizing OpenGL ES for iPhone OS, it's got a lot of useful tidbits on how to write speedy OpenGL applications on the iPhone.

like image 29
Adam Rosenfield Avatar answered Jan 19 '23 00:01

Adam Rosenfield