Cleaning up when exiting an OpenGL app

前端 未结 5 858
孤独总比滥情好
孤独总比滥情好 2021-01-05 06:21

I have an an OSX OpenGL app I\'m trying to modify. When I create the app a whole bunch of initialisation functions are called -- including methods where I can specify my own

5条回答
  •  有刺的猬
    2021-01-05 06:29

    In freeglut if you call this:

    glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_CONTINUE_EXECUTION)
    

    Prior to entering the main loop, then when the window closes the main loop function will return and you can do your cleanup.

    It's worth noting that at that stage the GL context has already been destroyed so you can't perform any GL operations.

提交回复
热议问题