Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MonoTouch OpenGL app loses texture data when moved to background

I have a MonoTouch OpenGL app that has a bunch of textures. When the user hits the iPhone button to move the app to the background, all my texture data seems to go away. I just see a solid color filling the triangles that I'm drawing with the textures that were loaded originally.

Any new textures that I load after resuming from the background state show up properly. It's just the textures that were loaded before the app was moved to the background that show up solid.

The docs state that "Your application should keep textures, models and other assets in memory" when it is moved to the background. I'm not doing anything to my textures, but something is forcing them out.

Any ideas?

like image 494
Mike Avatar asked Dec 05 '25 16:12

Mike


1 Answers

My solution was to not use iPhoneOSGameView. That fixed all problems related to textures disappearing when my app went background. The code to manage the framebuffers and update timer yourself is pretty simple and I found the extra clarity (and working restore-from-background) to be worth the effort.

Not using iPhoneOSGameView also makes me feel better about the application's timer actually running at full speed when the app is active:

like image 131
Mike Avatar answered Dec 08 '25 08:12

Mike



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!