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. --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403293
This commit is contained in:
parent
c0257e7bea
commit
b1b8c20318
1 changed files with 11 additions and 14 deletions
|
@ -121,7 +121,6 @@ SDL_RenderDriver GL_RenderDriver = {
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
SDL_GLContext context;
|
SDL_GLContext context;
|
||||||
SDL_bool updateSize;
|
|
||||||
SDL_bool GL_ARB_texture_rectangle_supported;
|
SDL_bool GL_ARB_texture_rectangle_supported;
|
||||||
SDL_bool GL_EXT_paletted_texture_supported;
|
SDL_bool GL_EXT_paletted_texture_supported;
|
||||||
int blendMode;
|
int blendMode;
|
||||||
|
@ -358,7 +357,10 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
|
||||||
} else {
|
} else {
|
||||||
data->glEnable(GL_TEXTURE_2D);
|
data->glEnable(GL_TEXTURE_2D);
|
||||||
}
|
}
|
||||||
data->updateSize = SDL_TRUE;
|
data->glMatrixMode(GL_PROJECTION);
|
||||||
|
data->glLoadIdentity();
|
||||||
|
data->glMatrixMode(GL_MODELVIEW);
|
||||||
|
data->glLoadIdentity();
|
||||||
|
|
||||||
return renderer;
|
return renderer;
|
||||||
}
|
}
|
||||||
|
@ -372,16 +374,9 @@ GL_ActivateRenderer(SDL_Renderer * renderer)
|
||||||
if (SDL_GL_MakeCurrent(window->id, data->context) < 0) {
|
if (SDL_GL_MakeCurrent(window->id, data->context) < 0) {
|
||||||
return -1;
|
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->glViewport(0, 0, window->w, window->h);
|
||||||
data->glOrtho(0.0, (GLdouble) window->w, (GLdouble) window->h, 0.0,
|
data->glOrtho(0.0, (GLdouble) window->w, (GLdouble) window->h, 0.0, 0.0,
|
||||||
0.0, 1.0);
|
1.0);
|
||||||
data->updateSize = SDL_FALSE;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,9 +384,11 @@ static int
|
||||||
GL_DisplayModeChanged(SDL_Renderer * renderer)
|
GL_DisplayModeChanged(SDL_Renderer * renderer)
|
||||||
{
|
{
|
||||||
GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
|
GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
|
||||||
|
SDL_Window *window = SDL_GetWindowFromID(renderer->window);
|
||||||
|
|
||||||
data->updateSize = SDL_TRUE;
|
data->glViewport(0, 0, window->w, window->h);
|
||||||
return 0;
|
data->glOrtho(0.0, (GLdouble) window->w, (GLdouble) window->h, 0.0, 0.0,
|
||||||
|
1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline__ int
|
static __inline__ int
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue