diff test/testgl2.c @ 3571:19691cebb866

Default to allow either accelerated or not
author Sam Lantinga <slouken@libsdl.org>
date Tue, 15 Dec 2009 20:53:09 +0000
parents 7812d3e9564e
children 762e40fb8e28
line wrap: on
line diff
--- a/test/testgl2.c	Tue Dec 15 20:36:31 2009 +0000
+++ b/test/testgl2.c	Tue Dec 15 20:53:09 2009 +0000
@@ -162,7 +162,7 @@
 int
 main(int argc, char *argv[])
 {
-    int fsaa, noaccel;
+    int fsaa, accel;
     int value;
     int i, done;
     SDL_DisplayMode mode;
@@ -172,7 +172,7 @@
 
     /* Initialize parameters */
     fsaa = 0;
-    noaccel = 0;
+    accel = -1;
 
     /* Initialize test framework */
     state = CommonCreateState(argv, SDL_INIT_VIDEO);
@@ -187,15 +187,15 @@
             if (SDL_strcasecmp(argv[i], "--fsaa") == 0) {
                 ++fsaa;
                 consumed = 1;
-            } else if (SDL_strcasecmp(argv[i], "--noaccel") == 0) {
-                ++noaccel;
-                consumed = 1;
+            } else if (SDL_strcasecmp(argv[i], "--accel") == 0 && i+1 < argc) {
+                accel = atoi(argv[i+1]);
+                consumed = 2;
             } else {
                 consumed = -1;
             }
         }
         if (consumed < 0) {
-            fprintf(stderr, "Usage: %s %s [--fsaa] [--noaccel]\n", argv[0],
+            fprintf(stderr, "Usage: %s %s [--fsaa] [--accel n]\n", argv[0],
                     CommonUsage(state));
             quit(1);
         }
@@ -213,7 +213,9 @@
         state->gl_multisamplebuffers = 1;
         state->gl_multisamplesamples = fsaa;
     }
-    state->gl_accelerated = !noaccel;
+    if (accel >= 0) {
+        state->gl_accelerated = accel;
+    }
 
     if (!CommonInit(state)) {
         quit(2);
@@ -282,13 +284,15 @@
                    SDL_GetError());
         }
     }
-    status = SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value);
-    if (!status) {
-        printf("SDL_GL_ACCELERATED_VISUAL: requested %d, got %d\n", !noaccel,
-               value);
-    } else {
-        printf("Failed to get SDL_GL_ACCELERATED_VISUAL: %s\n",
-               SDL_GetError());
+    if (accel >= 0) {
+        status = SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value);
+        if (!status) {
+            printf("SDL_GL_ACCELERATED_VISUAL: requested %d, got %d\n", accel,
+                   value);
+        } else {
+            printf("Failed to get SDL_GL_ACCELERATED_VISUAL: %s\n",
+                   SDL_GetError());
+        }
     }
 
     /* Set rendering settings */