Switched to use glutMainLoopEvent() with our own control flow.