Cleaning up when exiting an OpenGL app
- by Daniel
This might be a dumb question but I've spent some time asking Google and haven't been able to find anything.
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 mouse and keyboard handlers etc. For example:
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowPosition(100, 100);
glutInitWindowSize(700, 700);
glutCreateWindow("Map Abstraction");
glutReshapeFunc(resizeWindow);
glutDisplayFunc(renderScene);
glutIdleFunc(renderScene);
glutMouseFunc(mousePressedButton);
glutMotionFunc(mouseMovedButton);
glutKeyboardFunc(keyPressed);
At some point I pass control to glutMainLoop and my application runs. In the process of running I create a whole bunch of objects. I'd like to clean these up. Is there any way I can tell GLUT to call a cleanup method before it quits?