test/testgles.c
changeset 5363 96799a165806
parent 4961 c92950635837
child 5520 09b500e0656d
--- a/test/testgles.c	Sun Feb 20 13:56:57 2011 -0800
+++ b/test/testgles.c	Sun Feb 20 14:16:11 2011 -0800
@@ -177,7 +177,7 @@
         SDL_GL_SetSwapInterval(0);
     }
 
-    SDL_GetCurrentDisplayMode(&mode);
+    SDL_GetCurrentDisplayMode(0, &mode);
     printf("Screen bpp: %d\n", SDL_BITSPERPIXEL(mode.format));
     printf("\n");
     printf("Vendor     : %s\n", glGetString(GL_VENDOR));
@@ -243,6 +243,8 @@
 
     /* Set rendering settings for each context */
     for (i = 0; i < state->num_windows; ++i) {
+        float aspectAdjust;
+
         status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
         if (status) {
             printf("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
@@ -251,10 +253,11 @@
             continue;
         }
 
+        aspectAdjust = (4.0f / 3.0f) / ((float)state->window_w / state->window_h);
         glViewport(0, 0, state->window_w, state->window_h);
         glMatrixMode(GL_PROJECTION);
         glLoadIdentity();
-        glOrthof(-2.0, 2.0, -2.0, 2.0, -20.0, 20.0);
+        glOrthof(-2.0, 2.0, -2.0 * aspectAdjust, 2.0 * aspectAdjust, -20.0, 20.0);
         glMatrixMode(GL_MODELVIEW);
         glLoadIdentity();
         glEnable(GL_DEPTH_TEST);
@@ -275,7 +278,7 @@
                 switch (event.window.event) {
                     case SDL_WINDOWEVENT_RESIZED:
                         for (i = 0; i < state->num_windows; ++i) {
-                            if (event.window.windowID == state->windows[i]) {
+                            if (event.window.windowID == SDL_GetWindowID(state->windows[i])) {
                                 status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
                                 if (status) {
                                     printf("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
@@ -327,3 +330,5 @@
 }
 
 #endif /* HAVE_OPENGLES */
+
+/* vi: set ts=4 sw=4 expandtab: */