Implement "q" for quit program

This commit is contained in:
hasufell 2014-05-09 14:55:16 +02:00
parent f7fc2cb91b
commit 36a6e2aae4
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020

View File

@ -393,5 +393,19 @@ void keyboard(unsigned char key, int x, int y)
glTranslatef(0.0f, 0.0f, -1.0f); glTranslatef(0.0f, 0.0f, -1.0f);
break; break;
case 'q': case 'q':
gl_destroy();
break;
} }
} }
/**
* Destroy the gl session/window.
*/
static void gl_destroy(void)
{
free(obj->edges);
free(obj->vertices);
free(obj->faces);
free(obj);
glutDestroyWindow(glutGetWindow());
}