test/testgles2.c
changeset 8226 778fd6b223a6
parent 8149 681eb46b8ac4
child 8776 29aac8b813d9
--- a/test/testgles2.c	Wed Feb 19 11:03:03 2014 -0300
+++ b/test/testgles2.c	Thu Feb 20 16:12:11 2014 -0300
@@ -629,7 +629,7 @@
     while (!done) {
         /* Check for events */
         ++frames;
-        while (SDL_PollEvent(&event)) {
+        while (SDL_PollEvent(&event) && !done) {
             switch (event.type) {
             case SDL_WINDOWEVENT:
                 switch (event.window.event) {
@@ -654,16 +654,18 @@
             }
             SDLTest_CommonEvent(state, &event, &done);
         }
-        for (i = 0; i < state->num_windows; ++i) {
-            status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
-            if (status) {
-                SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
+        if (!done) {
+          for (i = 0; i < state->num_windows; ++i) {
+              status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
+              if (status) {
+                  SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
 
-                /* Continue for next window */
-                continue;
-            }
-            Render(state->window_w, state->window_h, &datas[i]);
-            SDL_GL_SwapWindow(state->windows[i]);
+                  /* Continue for next window */
+                  continue;
+              }
+              Render(state->window_w, state->window_h, &datas[i]);
+              SDL_GL_SwapWindow(state->windows[i]);
+          }
         }
     }