简体   繁体   English

应该总是调用glfwDestroyWindow吗?

[英]Should glfwDestroyWindow always be called?

I've recently found GLFW and have been trying out making a simple application with it and was wondering about glfwTerminate and glfwDestroyWindow. 我最近找到了GLFW,并且一直在尝试使用它创建一个简单的应用程序,并且想知道glfwTerminate和glfwDestroyWindow。 I understand that glfwTerminate will cleanup any windows that are still open so it should be safe to never call gflwDestroyWindow on the main window but should I still call gflwDestroyWindow before terminating or is it more just a personal preference? 我知道glfwTerminate会清理所有仍打开的窗口,因此永远不要在主窗口上调用gflwDestroyWindow应该是安全的,但是在终止之前我还是应该仍然调用gflwDestroyWindow还是仅仅是个人喜好?

To clarify which of the following are "better". 澄清以下哪个“更好”。

auto window = glfwCreateWindow(...);
// Do some things
glfwDestroyWindow(window);
glfwTerminate();

Or 要么

auto window = glfwCreateWindow(...);
// Do some things
glfwTerminate();

According to documentation 根据文件

All windows remaining when glfwTerminate is called are destroyed as well. 调用glfwTerminate时剩余的所有窗口也将被销毁。

you don't need to do call glfwDestroyWindow(window); 您不需要调用glfwDestroyWindow(window); . Although I suppose it is better to destroy each window separately. 尽管我认为最好分别销毁每个窗口。

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

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