views:

139

answers:

1

I'm watching a WWDC video (session 105) that's talking about multitasking with iOS 4. Something interesting was just mentioned:

"any GPU usage while your app is in either of the background states results in automatic termination of the app. This includes any calls to OpenGL."

How does one handle this "requirement" if the entire app is OpenGL based?

Note: I asked this question because my OpenGL based app seems to do multitasking just fine in the simulator but not on the device (iPhone 4)... the app is automatically terminated when run on the device. It may be due to "inefficient" memory allocation (I don't release any resources when the app goes to the background)... or it could be due to this "no GPU usage" restriction I just learned about.

+1  A: 

You need to separate processing logic from draw and update (OpenGL calls). Then, you can set a global state for your app when going in and out of background states (applicationDidEnterBackground / applicationWillEnterForeground) and use that flag to skip your OpenGL drawing calls (and any other code that should not be executed from the background state).

Adisak