How to render consistence and smooth moving animation on iphone / ipod / iphone simulator.
Posted
by shakthi
on Stack Overflow
See other posts from Stack Overflow
or by shakthi
Published on 2010-04-07T12:08:42Z
Indexed on
2010/04/07
12:13 UTC
Read the original article
Hit count: 266
I am trying render a simple animation(object movement animations) on iphone. I used opengl for object rendering. Movements appears to be smooth on the simulator. But if I used same code in the ipod, object movement is slower. In the iphone it is still slower.
I googled a bit and found 'frame rate independent rendering method', which taught me the concept of 'time interval' and object movement based on it. However result is very unpleasant. There is a lot of jerk in the animation even when fps remains above 20.
Following code fragment is used for calculation of time interval between successive frames and I am using that to move my animation.
NSTimeInterval GetTimeIntervals(NSTimeInterval * inLastElapsedTime )
{
NSTimeInterval intervalTime = 0;
NSTimeInterval currentTime = [NSDate timeIntervalSinceReferenceDate];
if(*inLastElapsedTime != 0 )
{
intervalTime = currentTime - *inLastElapsedTime;
}
*inLastElapsedTime = currentTime;
return intervalTime;
}
© Stack Overflow or respective owner