I am using a shader to animate the texture. Currently the animation is a simple scrolling. Obviously I’m using CC_Time uniform variable to make things happen. But currently (version 2.1.4) Cocos2d has a problem with CC_Time’s precision. It appears that after quite a short peroid of time, about 10000 frames which is about 2.7 minutes, the precision of mediump float drops significantly. Thus modifying the uv-coordinates of the texture which belongs to [0.0; 1.0] becomes noticeably jerky.
Solution is quite simple (however I’m uncertain about performance). CC_Time should have a highp precision qualifier. I have tested this solution for about an hour and it seems the animation stayed smooth.
Another possible solution is to pass truncated values from the C++ code to the shader’s uniform variable. Smaller floats have higher precision and vice versa (that’s why they are called ‘floats’). Although this solution may be not all-purpose since we don’t know what range of values will be required by client’s shader.
It would be great if someone of authors or contributors comment this situation.