ipad full screen (1024x768) animation with around 1800 frames fps problem

Posted by Muhammad Farhan on Stack Overflow See other posts from Stack Overflow or by Muhammad Farhan
Published on 2010-06-08T12:39:44Z Indexed on 2010/06/08 12:42 UTC
Read the original article Hit count: 279

Filed under:

Hi there. what i am trying to do is to play a full screen(1024x768) animation on ipad with an fps of around 20. i have got a scene with 1800 full screen frames. till now i have tried a lot of approaches but have encountered a lot of problems.

my first approach was to get the texture using the following function t = [[CCTexture2D alloc] initWithImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"(%d)",startIndex] ofType:type]]];

give it to sprite by using setTexture method and then release the texture then create a new texture with next frame and repeat the procedure but by using this approach i only get an FPS of about 7.

my second approach was to preload about 10 textures in texturecache save them in an array and give them to sprite using setTexture and on the back end i am replacing the old textures with the new texture in a thread but the problem i face is that creating new texture and adding to array takes some time and when the settexture method is called the sprite displays the old texture because the new one is not loaded yet but after some time new texture get loaded.

Is there any way i can run a full screen animation on ipad at around 20 fps plesae help me out.

Thanks

Farhan

© Stack Overflow or respective owner

Related posts about objective-c