senthilmuthu
senthilmuthu

Reputation:

2d games in openGL

hai I am new to iphone development. I used NSTimer scheduledTimerWithTimeInterval 0.01 seconds for game loop. The game consists drawscreen function inwhich I use CGContextClipToRect to clip the large images for animation. But the speed 0.01 seconds is working in simulator only not in the iphone(device). How can i overcome this problem? I respect your reply......you have told about it in previous post. But i could not understand..... can anyone give tutorial to do this in openGL like (CGContextClipToRect in openGL),animation of 2d images,drawing,clipping etc,sample source code.....

Upvotes: 0

Views: 626

Answers (3)

Gordon Childs
Gordon Childs

Reputation: 36074

The iPhone OpenGL ES implementation likes 60 fps, so set that timer interval to 1.0/60.

Use XCode's OpenGL ES profile (under Run->Start with Performance Tool)
to verify that you are indeed getting 60fps.

Upvotes: 1

nvuono
nvuono

Reputation: 3363

Keep in mind that a refresh interval of 0.01 seconds is equivalent to 100 frames per second. I would start by increasing the interval to at least 0.02 seconds (50fps) or 0.0333 seconds (30 fps).

Upvotes: 0

Maniacdev
Maniacdev

Reputation: 275

you'll find there are differences with the simulator and on the actual device especially in regards to the possible frame rate. Check out the free Cocos2D http://code.google.com/p/cocos2d-iphone/ it provides extensive 2d functionality and has already proven it's use in many games.

Upvotes: 2

Related Questions