diff src/video/SDL_renderer_gl.c @ 2836:b128b94ed31e

Rebind the context to the window area and update matrices when the window size changes
author Sam Lantinga <slouken@libsdl.org>
date Sat, 06 Dec 2008 05:23:35 +0000
parents f38257b5d936
children f89700cc9272
line wrap: on
line diff
--- a/src/video/SDL_renderer_gl.c	Sat Dec 06 00:56:47 2008 +0000
+++ b/src/video/SDL_renderer_gl.c	Sat Dec 06 05:23:35 2008 +0000
@@ -423,7 +423,13 @@
         return -1;
     }
     if (data->updateSize) {
-        GL_DisplayModeChanged(renderer);
+        data->glMatrixMode(GL_PROJECTION);
+        data->glLoadIdentity();
+        data->glMatrixMode(GL_MODELVIEW);
+        data->glLoadIdentity();
+        data->glViewport(0, 0, window->w, window->h);
+        data->glOrtho(0.0, (GLdouble) window->w, (GLdouble) window->h, 0.0,
+                      0.0, 1.0);
         data->updateSize = SDL_FALSE;
     }
     return 0;
@@ -433,16 +439,10 @@
 GL_DisplayModeChanged(SDL_Renderer * renderer)
 {
     GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
-    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
 
-    data->glMatrixMode(GL_PROJECTION);
-    data->glLoadIdentity();
-    data->glMatrixMode(GL_MODELVIEW);
-    data->glLoadIdentity();
-    data->glViewport(0, 0, window->w, window->h);
-    data->glOrtho(0.0, (GLdouble) window->w, (GLdouble) window->h, 0.0, 0.0,
-                  1.0);
-    return 0;
+    /* Rebind the context to the window area and update matrices */
+    data->updateSize = SDL_TRUE;
+    return GL_ActivateRenderer(renderer);
 }
 
 static __inline__ int