views:

14

answers:

1

Hi all Im having a problem with an iphone app that im working on.im using objective c and cocos2d. The frame rate just drops drastically. I have tested for leaks and allocations etc using instruments and all looks good on that front. I am not using any particles or sound at the moment so its not anything like that. its just animated sprites and swapping around of layers. I have stepped through it many times and it is going into the deallocs of each layer as appropriate as well as checking the retain counts on everything to be sure all is getting released but frame rate still drops when i swap between layers. the log is giving me this CCLOG(@"cocos2d: Failed to swap renderbuffer in %s\n", FUNCTION); which is called in -[EAGLView swapBuffers] but i have no idea what that is or how to solve it. cpu sampler says this is taking up 77.2% of cpu time. any ideas would be great im stumped at the moment cheers. g

+2  A: 

This can occur if you are still drawing to the EAGLView whilst it is being swapped out. Check where you are swapping the buffer and ensure you stop all animation before you swap and resume after.

Simon Lee
i was trying that too by using [[CCDirector sharedDirector] stopAnimation] ; hudLayer = [[HUDLayer alloc]init]; [self addChild:hudLayer z:2]; [[CCDirector sharedDirector] startAnimation] ; is this how you ment ? if not can u give me an example? please and thanks