views:

138

answers:

0

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;
}