简体   繁体   English

在iPhone上执行OpenGL之后清理

[英]Cleaning Up After OpenGL on iPhone

Right now, I'm playing with OpenGL ES on the iPhone using Oolong Engine. 现在,我正在使用Oolong Engine在iPhone上玩OpenGL ES。 This might be a silly question, but how necessary is it to clean up after OpenGL when the app exits? 这可能是一个愚蠢的问题,但是在退出应用程序后在OpenGL之后进行清理的必要性是什么? 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> . 因此,所有VBO和纹理的句柄都存储在static map<Model>中的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() . 当应用关闭时,地图似乎没有调用单个Model对象上的析构函数,因此它们最终不会调用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? 还是OpenGL会为我照顾所有这些? I could make a static CleanUp() function that gets called from the application's dealloc , but is that worth it? 我可以创建一个从应用程序的dealloc调用的静态CleanUp()函数,但这值得吗?

When the actual app exits, all resources get cleaned up with it, including all GL stuff. 当实际的应用程序退出时,所有资源(包括所有GL内容)都会被清除。 Don't worry, the OS wouldn't let your rogue app accidentally leak a bunch of GPU resources. 别担心,该操作系统不会让您的流氓应用程序意外泄漏大量GPU资源。

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. 通常,在应用程序的生命周期中,当然应该管理Open GL中的资源,但这听起来像您知道该怎么做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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