Currently I have a PNG animation on a timer that is firing every .01 seconds. However, performance isn\'t optimal and the animation is visibly slow. I have over 2000 images.
exactly what size (I mean KB and also the exact pixel size) are your PNGs?
We have done a lot of work on this and have no trouble playing animations, on the pad, of about say 500x500. So I'm just wondering, thanks.
One immediate problem is that you are trying to run at 100hz, 100 times per second??!
That is absolutely impossible. Nothing runs at 100 fps. 20fps is "extremely smooth", 30fps is "staggeringly smooth", 40fps is "mindboggling human-vision-research-level smooth if it could be achieved" and 100 fps cannot be achieved.
This has absolutely utterly nothing whatsoever to do with OpenGLES.
The ordinary environment will load frames very quickly for you.
So first go back to 30 fps (at most!) and throw away every 2nd and 3rd image so the animation looks the same. ie, "i=i++" becomes "i+=3" in your line of code.
it is likely that this is the overwhelming problem that is ruining your efforts!
Next problem! If you do load up each image like that as you go, you will almost certainly need to release them all on the fly as you go with a pair of lines something like...
[happy.image release];
happy.image = [[UIImage alloc] initWithContentsOfFile:
[[NSBundle mainBundle] pathForResource:@"blah" ofType:@"png"]];
If you don't do that it just won't work.
Next problem! The idea of using video is no good, but could you just use an everyday animated image? Thus...
#define BI(X) [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@X ofType:@"tif"]]
happyDays = [[NSArray alloc] initWithObjects:
BI("hh00"), BI("hh01"), BI("hh02"), BI("hh03"), BI("hh04"), BI("hh05"), BI("hh06"), BI("hh07"), BI("hh08"), BI("hh09"),
BI("hh10"), BI("hh11"), BI("hh12"), BI("hh13"), BI("hh14"), BI("hh15"), BI("hh16"), BI("hh17"), BI("hh18"), BI("hh19"), etc etc etc
nil];
animArea.animationImages = happyDays;
animArea.animationDuration = 2.88;
// that is overall seconds. hence: frames divided by about 30 or 20.
[animArea startAnimating];
No good for your situation?
Anyway, in one word your problem is 100 fps. Change to 20 fps and you will have no trouble. And let us know the precise image size (kb / x.y).
How about CADisplayLink for managing fps?
OpenGLES needs to spend time to convert an image to texture, and texture needs careful memory management. When memory is not enough, it will generate a whole white texture.
Encode your animation as a video and play the video instead.