changeset 2832:0379769e8caa

The matrices have already been set, so you don't have to re-set them. You always need to reset the viewport when activating the renderer in case the context had been set to a different window previously.
author Sam Lantinga <slouken@libsdl.org>
date Fri, 05 Dec 2008 06:22:19 +0000
parents 7173fc5c7ef6
children c2e182a37f5f
files src/video/SDL_renderer_gl.c
diffstat 1 files changed, 11 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/SDL_renderer_gl.c	Fri Dec 05 06:19:49 2008 +0000
+++ b/src/video/SDL_renderer_gl.c	Fri Dec 05 06:22:19 2008 +0000
@@ -121,7 +121,6 @@
 typedef struct
 {
     SDL_GLContext context;
-    SDL_bool updateSize;
     SDL_bool GL_ARB_texture_rectangle_supported;
     SDL_bool GL_EXT_paletted_texture_supported;
     int blendMode;
@@ -358,7 +357,10 @@
     } else {
         data->glEnable(GL_TEXTURE_2D);
     }
-    data->updateSize = SDL_TRUE;
+    data->glMatrixMode(GL_PROJECTION);
+    data->glLoadIdentity();
+    data->glMatrixMode(GL_MODELVIEW);
+    data->glLoadIdentity();
 
     return renderer;
 }
@@ -372,16 +374,9 @@
     if (SDL_GL_MakeCurrent(window->id, data->context) < 0) {
         return -1;
     }
-    if (data->updateSize) {
-        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;
-    }
+    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;
 }
 
@@ -389,9 +384,11 @@
 GL_DisplayModeChanged(SDL_Renderer * renderer)
 {
     GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
+    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
 
-    data->updateSize = SDL_TRUE;
-    return 0;
+    data->glViewport(0, 0, window->w, window->h);
+    data->glOrtho(0.0, (GLdouble) window->w, (GLdouble) window->h, 0.0, 0.0,
+                  1.0);
 }
 
 static __inline__ int