简体   繁体   中英

Cleaning Up After OpenGL on iPhone

Right now, I'm playing with OpenGL ES on the iPhone using Oolong Engine. This might be a silly question, but how necessary is it to clean up after OpenGL when the app exits? My problem is that I have a static vector that manages loading models, and loosely ensures that models aren't loaded twice. Because of this, all the handles to the VBOs and textures are stored in Model objects in a static map<Model> . When the app closes down, the map doesn't seem to call the destructors on the individual Model objects, so they don't end up calling glDeleteBuffers() .

My question is, is this entirely necessary, if the application is small enough that I'm never unloading and reloading models from memory during runtime? Or does OpenGL just take care of all that for me? I could make a static CleanUp() function that gets called from the application's dealloc , but is that worth it?

When the actual app exits, all resources get cleaned up with it, including all GL stuff. Don't worry, the OS wouldn't let your rogue app accidentally leak a bunch of GPU resources.

Managing resources in Open GL in general is something you should do of course during the course of your app's life, but it sounds like you know how to do this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM