iOS OpenGL ES 1.1 jerky animation using CADisplayLink (reboot fixes for a while)
Posted
by
timthecoder
on Stack Overflow
See other posts from Stack Overflow
or by timthecoder
Published on 2012-09-02T20:39:59Z
Indexed on
2012/09/15
3:38 UTC
Read the original article
Hit count: 190
I'm using OpenGL ES 1.1 and CADisplayLink to animate a 3d scene. If the iOS device has been rebooted fairly recently, the animation is smooth and the time delta between two displayLink.timestamp calls is fairly even. But after a few hours or days of the iOS device being used and my app is sometimes run a few times, the animation becomes jerky and the time deltas ramp up and then reset to a lower value only to ramp up again.
Like this:
2012-09-01 23:42:58.770 [2678:707] dt= 0.021139
2012-09-01 23:42:58.787 [2678:707] dt= 0.022183
2012-09-01 23:42:58.804 [2678:707] dt= 0.023223
2012-09-01 23:42:58.820 [2678:707] dt= 0.024270
2012-09-01 23:42:58.837 [2678:707] dt= 0.009679
2012-09-01 23:42:58.853 [2678:707] dt= 0.010750
2012-09-01 23:42:58.870 [2678:707] dt= 0.011766
2012-09-01 23:42:58.887 [2678:707] dt= 0.012806
2012-09-01 23:42:58.903 [2678:707] dt= 0.013847
2012-09-01 23:42:58.920 [2678:707] dt= 0.014890
2012-09-01 23:42:58.937 [2678:707] dt= 0.015933
2012-09-01 23:42:58.953 [2678:707] dt= 0.016976
2012-09-01 23:42:58.970 [2678:707] dt= 0.018011
2012-09-01 23:42:58.987 [2678:707] dt= 0.019055
2012-09-01 23:42:59.003 [2678:707] dt= 0.020097
2012-09-01 23:42:59.020 [2678:707] dt= 0.021143
2012-09-01 23:42:59.037 [2678:707] dt= 0.022181
2012-09-01 23:42:59.054 [2678:707] dt= 0.023222
2012-09-01 23:42:59.071 [2678:707] dt= 0.024288
2012-09-01 23:42:59.087 [2678:707] dt= 0.009624
2012-09-01 23:42:59.103 [2678:707] dt= 0.010728
2012-09-01 23:42:59.121 [2678:707] dt= 0.011763
2012-09-01 23:42:59.137 [2678:707] dt= 0.012808
2012-09-01 23:42:59.153 [2678:707] dt= 0.013847
2012-09-01 23:42:59.170 [2678:707] dt= 0.014891
2012-09-01 23:42:59.187 [2678:707] dt= 0.016002
2012-09-01 23:42:59.203 [2678:707] dt= 0.016979
2012-09-01 23:42:59.220 [2678:707] dt= 0.018016
2012-09-01 23:42:59.237 [2678:707] dt= 0.019042
2012-09-01 23:42:59.253 [2678:707] dt= 0.020099
2012-09-01 23:42:59.270 [2678:707] dt= 0.021138
2012-09-01 23:42:59.287 [2678:707] dt= 0.022185
2012-09-01 23:42:59.304 [2678:707] dt= 0.023222
2012-09-01 23:42:59.320 [2678:707] dt= 0.024265
2012-09-01 23:42:59.337 [2678:707] dt= 0.009681
2012-09-01 23:42:59.354 [2678:707] dt= 0.010736
And then if the iOS device is rebooted the animation is smooth again.
The problem even occurs on my menu screen when almost no game related calculations are going on in the UpdateAnimation() function.
I don't understand what is going on and why a fresh reboot will always fix this problem for a while.
© Stack Overflow or respective owner