touches and FPS (OpenGL)
Hi!
I use OpenGL and NSTimer (interval is 1/30, actual framerate is 30-25 FPS depending on how many objects rendered for current frame).
Everything works nice and smooth - unless I touch and hold screen - FPS drops by 7 frames or so. When I release finger - FPS goes up again.
Removing all the -(void)touches... callbacks from my code does not change anything.
Was trying CFRunLoopRunInMode instead of NSTimer - same result.
I'm using slightly modified MyEAGLView from CrashLanding example.
I'm puzzled, would really appreciate any help/ideas.
Thanks!
I use OpenGL and NSTimer (interval is 1/30, actual framerate is 30-25 FPS depending on how many objects rendered for current frame).
Everything works nice and smooth - unless I touch and hold screen - FPS drops by 7 frames or so. When I release finger - FPS goes up again.
Removing all the -(void)touches... callbacks from my code does not change anything.
Was trying CFRunLoopRunInMode instead of NSTimer - same result.
I'm using slightly modified MyEAGLView from CrashLanding example.
I'm puzzled, would really appreciate any help/ideas.
Thanks!
I noticed slowdowns whenever I was logging to the console- are you logging to the console every frame?
no logging, I actually do nothing on touch events - commented out all the touches... code to make sure it does not slow down somewhere in my game logic.
I've heard that certain timers that could be used for other reasons like time based movement can cause issues with the touches. Without knowing anything about your code, I'd first guess that it's what you're doing when a touch is detected that is slowing it down. It could be the way you're passing around the touch events but that's less likely. Other than that, without knowing anything about your code it's hard to speculate.
As he said, he is not even listening to touches. I haven't seen this happening in my app but I will watch for it and if I see it I will post something. Question are you using opengl? If you are using the built in stuff, and have lots of visual components, it might scan all their bounds for touches even if you aren't looking for touches yourself. So if your game has tons of ui components that might cause it.
Unless you're creating a separate thread for it, a timer fires in the same runloop as the handlers for touch events, which makes timers less able to maintain a stable FPS than a thread (or having a timer on a separate thread). For more heated discussion on this topic see this thread.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| touches offset? | Jamie W | 11 | 10,098 |
Aug 18, 2011 10:23 AM Last Post: MattDiamond |
|
| How to get number of active touches? | Rasterman | 8 | 5,836 |
Apr 21, 2010 03:56 PM Last Post: longjumper |
|
| not getting touches for top 20 pixels | Rasterman | 10 | 5,535 |
Apr 8, 2010 01:00 AM Last Post: fattoh |
|
| Touches are slowing down game | Jamie W | 8 | 4,948 |
Mar 26, 2010 03:41 PM Last Post: Jamie W |
|
| Touches Lagging & Skipping | hippocoder | 0 | 1,630 |
Mar 8, 2010 09:20 AM Last Post: hippocoder |
|

