diff --git a/glxgears.c b/glxgears.c index ea6697a..76b55f8 100644 --- a/glxgears.c +++ b/glxgears.c @@ -312,7 +312,7 @@ static void reshape(int width, int height) { glMatrixMode(GL_MODELVIEW); } -static void init(int argc, char *argv[]) { +static void init_scene(void) { glLightfv(GL_LIGHT0, GL_POSITION, (const GLfloat[]){5.0, 5.0, 10.0, 0.0}); glEnable(GL_CULL_FACE); glEnable(GL_LIGHTING); @@ -347,7 +347,14 @@ static void init(int argc, char *argv[]) { glEndList(); glEnable(GL_NORMALIZE); +} +static void visible(int vis) { + Visible = vis; + update_idle_func(); +} + +void parse_args(int argc, char *argv[]) { for (GLint i = 1; i < argc; i++) { if (strcmp(argv[i], "-info") == 0) { printf("GL_VENDOR = %s\n", (char *)glGetString(GL_VENDOR)); @@ -365,17 +372,12 @@ static void init(int argc, char *argv[]) { } } -static void visible(int vis) { - Visible = vis; - update_idle_func(); -} - int main(int argc, char *argv[]) { - glutInitWindowSize(300, 300); + parse_args(argc, argv); glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); win = glutCreateWindow("Gears"); - init(argc, argv); + init_scene(); glutDisplayFunc(draw); glutReshapeFunc(reshape);