Added support for opengl/glut flags and made code somewhat more extensible