hi,
usually my game runs fine at 50fps, or whatever it is limited to by vsync.
After i switch to a different activity, for example to a facebook login, a fullscreen ad or a webbrowser and back again, my fps get very inconsistent.
While the FPS stay the same on average, the time between the frames starts to vary a lot.
Here is a log of the times (in milliseconds) before another activity was shown:
I/cocos2d-x(14446): Sleeping took : 17 I/cocos2d-x(14446): Rendering took: 3 I/cocos2d-x(14446): Sleeping took : 16 I/cocos2d-x(14446): Rendering took: 4 I/cocos2d-x(14446): Sleeping took : 16 I/cocos2d-x(14446): Rendering took: 4 I/cocos2d-x(14446): Sleeping took : 16
and afterwards:
I/cocos2d-x(14446): Sleeping took : 31 I/cocos2d-x(14446): Rendering took: 5 I/cocos2d-x(14446): Sleeping took : 3 I/cocos2d-x(14446): Rendering took: 4 I/cocos2d-x(14446): Sleeping took : 33 I/cocos2d-x(14446): Rendering took: 6 I/cocos2d-x(14446): Sleeping took : 9 I/cocos2d-x(14446): Rendering took: 4
the times were taken inside the Cocos2dxRenderer.onDrawFrame method. But i removed the Sleeping inside the function.
public void onDrawFrame(final GL10 gl) {
Log.i("cocos2d-x", "Sleeping took : " + (System.currentTimeMillis() - lastRenderEnd) );
long renderStart = System.currentTimeMillis( );
Cocos2dxRenderer.nativeRender();
Log.i("cocos2d-x", "Rendering took: " + (System.currentTimeMillis( ) - renderStart) );
lastRenderEnd = System.currentTimeMillis( );
}
Cocos2d-x version: cocos2d-2.0-x-2.0.4
Android SDK: 13
The effect is also varies from device to device.
On a Motorla Defy the jitter continues until restart. On a Galaxy S3 it jitters for a couple of seconds.
Can anyone imagine a possible source of this problem?
regards
Philipp