1

I have a trouble with FPS on iPhone 4. I want to put a large image on the screen and when I do this FPS goes down(50-51 on iPhone 4). Same effect when I use CCSpriteBatchNode :(
As I guessed the problem is drawing. I just put the image on the screen not moving it and FPS drops to 50-51.

Rendel
  • 1,794
  • 3
  • 13
  • 16
  • possibly related to - http://stackoverflow.com/questions/3899903/how-to-draw-a-background-fast-in-cocos2d – Anya Shenanigans Apr 02 '13 at 10:58
  • Thanks for a reply. I've tried that but didn't help :( Any other suggestion? – Rendel Apr 02 '13 at 11:20
  • A single 960x480 fullscreen Retina background should not affect framerate. Does the app do anything else besides displaying a background image? How big is the image? Do you constantly change the background image? – CodeSmile Apr 02 '13 at 15:12
  • I put 2 images (both 960x550 for retina). I don't change the background image. I only move them. Here is some code about that image: `back1.position = ccp(back1.position.x - speed, back1.position.y);` `back2.position = ccp(back2.position.x - speed, back2.position.y);` `if(back1.position.x <= -screenSize.width/2)` `back1.position = ccp(back2.position.x+back1.contentSize.width,back1.position.y);` `else if(back2.position.x <= -screenSize.width/2)` `back2.position = ccp(back1.position.x + back1.contentSize.width, back2.position.y);` – Rendel Apr 02 '13 at 15:37

1 Answers1

0

Ok, I found solution myself.

I enabled CC_ENABLE_GL_STATE_CACHE and my FPS is 60.0 now. To enable it just change CC_ENABLE_GL_STATE_CACHE 0 to CC_ENABLE_GL_STATE_CACHE 1 in ccconfig.h

I hope this will help some1.

Rendel
  • 1,794
  • 3
  • 13
  • 16