diff --git a/glxgears.c b/glxgears.c index c9b4754..1d5e99a 100644 --- a/glxgears.c +++ b/glxgears.c @@ -310,6 +310,8 @@ static void reshape(int width, int height) { glMatrixMode(GL_MODELVIEW); } +static GLboolean print_glinfo = GL_FALSE; + static void init_scene(void) { glLightfv(GL_LIGHT0, GL_POSITION, (const GLfloat[]){5.0, 5.0, 10.0, 0.0}); glEnable(GL_CULL_FACE); @@ -345,6 +347,14 @@ static void init_scene(void) { glEndList(); glEnable(GL_NORMALIZE); + + if (print_glinfo) { + printf("GL_VENDOR = %s\n", (char *)glGetString(GL_VENDOR)); + printf("GL_RENDERER = %s\n", (char *)glGetString(GL_RENDERER)); + printf("GL_VERSION = %s\n", (char *)glGetString(GL_VERSION)); + printf("GL_EXTENSIONS = %s\n", (char *)glGetString(GL_EXTENSIONS)); + fflush(stdout); + } } static void visible(int vis) { @@ -355,24 +365,24 @@ static void visible(int vis) { static char *window_title = "Gears"; static void parse_args(int argc, char *argv[]) { +#ifdef USE_ARGP + +#else for (GLint i = 1; i < argc; i++) - if (strcmp(argv[i], "-info") == 0) { - printf("GL_VENDOR = %s\n", (char *)glGetString(GL_VENDOR)); - printf("GL_RENDERER = %s\n", (char *)glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", (char *)glGetString(GL_VERSION)); - printf("GL_EXTENSIONS = %s\n", (char *)glGetString(GL_EXTENSIONS)); - fflush(stdout); - } else if (strcmp(argv[i], "-exit") == 0) { + if (strcmp(argv[i], "-exit") == 0) { autoexit = 30; printf("Auto Exit after %i seconds.\n", autoexit); fflush(stdout); - } else if (strcmp(argv[i], "-noanim") == 0) + } else if (strcmp(argv[i], "-info") == 0) + print_glinfo = GL_TRUE; + else if (strcmp(argv[i], "-noanim") == 0) Animate = GL_FALSE; +#endif } int main(int argc, char *argv[]) { - parse_args(argc, argv); glutInit(&argc, argv); + parse_args(argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); win = glutCreateWindow(window_title); init_scene();