title: Cleaning up when exiting an OpenGL app
body: <p>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:</p>
  
  <pre><code>glutInit(&amp;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);
  </code></pre>
  
  <p>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?</p>