Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Rebind the context to the window area and update matrices when the wi…
Browse files Browse the repository at this point in the history
…ndow size changes
  • Loading branch information
slouken committed Dec 6, 2008
1 parent dbc88d3 commit 8d0d5b4
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/video/SDL_renderer_gl.c
Expand Up @@ -423,7 +423,13 @@ GL_ActivateRenderer(SDL_Renderer * renderer)
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;
Expand All @@ -433,16 +439,10 @@ static int
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
Expand Down

0 comments on commit 8d0d5b4

Please sign in to comment.