you should not combine glut procedures together with a form. glut is for use with a console like program. That wont leave you with an open form. But if you want to use it with a form you could call application.terminate directly after your glutmainloop.