diff options
author | Sam Lantinga <slouken@libsdl.org> | 2008-12-05 07:00:58 +0000 |
---|---|---|
committer | Sam Lantinga <slouken@libsdl.org> | 2008-12-05 07:00:58 +0000 |
commit | 438661db5e7af1e85fe69c02e10c5bd2e017f73b (patch) | |
tree | c89a1d7eb63b5948292d321f4c5a7cec4a3921bf /src | |
parent | 2e83d0061eed32968999f39ff971da21873b5554 (diff) |
Whoops, can't call glOrtho() repeatedly
Diffstat (limited to 'src')
-rw-r--r-- | src/video/SDL_renderer_gl.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/video/SDL_renderer_gl.c b/src/video/SDL_renderer_gl.c index afd20a34f3..0da25f72af 100644 --- a/src/video/SDL_renderer_gl.c +++ b/src/video/SDL_renderer_gl.c @@ -121,6 +121,7 @@ SDL_RenderDriver GL_RenderDriver = { typedef struct { SDL_GLContext context; + SDL_bool updateSize; SDL_bool GL_ARB_texture_rectangle_supported; SDL_bool GL_EXT_paletted_texture_supported; int blendMode; @@ -357,10 +358,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) } else { data->glEnable(GL_TEXTURE_2D); } - data->glMatrixMode(GL_PROJECTION); - data->glLoadIdentity(); - data->glMatrixMode(GL_MODELVIEW); - data->glLoadIdentity(); + data->updateSize = SDL_TRUE; return renderer; } @@ -374,9 +372,10 @@ GL_ActivateRenderer(SDL_Renderer * renderer) if (SDL_GL_MakeCurrent(window->id, data->context) < 0) { return -1; } - data->glViewport(0, 0, window->w, window->h); - data->glOrtho(0.0, (GLdouble) window->w, (GLdouble) window->h, 0.0, 0.0, - 1.0); + if (data->updateSize) { + GL_DisplayModeChanged(renderer); + data->updateSize = SDL_FALSE; + } return 0; } @@ -386,9 +385,14 @@ 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; } static __inline__ int |