Fixed bug 3355 - false "Invalid renderer" after creating an "opengles2" renderer. Call SDL_GL_GetDrawableSize() directly because we may be in the initialization path and SDL_GetRendererOutputSize() will fail because the renderer magic isn't set up yet.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c
index 85319ea..410de46 100644
--- a/src/render/opengl/SDL_render_gl.c
+++ b/src/render/opengl/SDL_render_gl.c
@@ -592,7 +592,6 @@ static int
GL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
{
SDL_GL_GetDrawableSize(renderer->window, w, h);
-
return 0;
}
@@ -1020,7 +1019,7 @@ GL_UpdateViewport(SDL_Renderer * renderer)
} else {
int w, h;
- SDL_GetRendererOutputSize(renderer, &w, &h);
+ SDL_GL_GetDrawableSize(renderer, &w, &h);
data->glViewport(renderer->viewport.x, (h - renderer->viewport.y - renderer->viewport.h),
renderer->viewport.w, renderer->viewport.h);
}
@@ -1058,7 +1057,7 @@ GL_UpdateClipRect(SDL_Renderer * renderer)
} else {
int w, h;
- SDL_GetRendererOutputSize(renderer, &w, &h);
+ SDL_GL_GetDrawableSize(renderer, &w, &h);
data->glScissor(renderer->viewport.x + rect->x, h - renderer->viewport.y - rect->y - rect->h, rect->w, rect->h);
}
} else {
diff --git a/src/render/opengles/SDL_render_gles.c b/src/render/opengles/SDL_render_gles.c
index f0856d7..5f96b22 100644
--- a/src/render/opengles/SDL_render_gles.c
+++ b/src/render/opengles/SDL_render_gles.c
@@ -672,7 +672,7 @@ GLES_UpdateViewport(SDL_Renderer * renderer)
} else {
int w, h;
- SDL_GetRendererOutputSize(renderer, &w, &h);
+ SDL_GL_GetDrawableSize(renderer, &w, &h);
data->glViewport(renderer->viewport.x, (h - renderer->viewport.y - renderer->viewport.h),
renderer->viewport.w, renderer->viewport.h);
}
@@ -715,7 +715,7 @@ GLES_UpdateClipRect(SDL_Renderer * renderer)
} else {
int w, h;
- SDL_GetRendererOutputSize(renderer, &w, &h);
+ SDL_GL_GetDrawableSize(renderer, &w, &h);
data->glScissor(renderer->viewport.x + rect->x, h - renderer->viewport.y - rect->y - rect->h, rect->w, rect->h);
}
} else {
diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c
index c419c0f..c846a7b 100644
--- a/src/render/opengles2/SDL_render_gles2.c
+++ b/src/render/opengles2/SDL_render_gles2.c
@@ -388,7 +388,7 @@ GLES2_UpdateViewport(SDL_Renderer * renderer)
} else {
int w, h;
- SDL_GetRendererOutputSize(renderer, &w, &h);
+ SDL_GL_GetDrawableSize(renderer->window, &w, &h);
data->glViewport(renderer->viewport.x, (h - renderer->viewport.y - renderer->viewport.h),
renderer->viewport.w, renderer->viewport.h);
}
@@ -417,7 +417,7 @@ GLES2_UpdateClipRect(SDL_Renderer * renderer)
} else {
int w, h;
- SDL_GetRendererOutputSize(renderer, &w, &h);
+ SDL_GL_GetDrawableSize(renderer->window, &w, &h);
data->glScissor(renderer->viewport.x + rect->x, h - renderer->viewport.y - rect->y - rect->h, rect->w, rect->h);
}
} else {