mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
Better fix for bug 2207 - SDL_RenderSetViewport behavior is different/incorrect on OpenGL renderer vs DirectX renderer
At least, it works better here on my Mac. :)
This commit is contained in:
parent
44959a21ef
commit
8093cfd8ce
@ -919,13 +919,21 @@ GL_UpdateViewport(SDL_Renderer * renderer)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (renderer->target) {
|
||||||
data->glViewport(renderer->viewport.x, renderer->viewport.y,
|
data->glViewport(renderer->viewport.x, renderer->viewport.y,
|
||||||
renderer->viewport.w, renderer->viewport.h);
|
renderer->viewport.w, renderer->viewport.h);
|
||||||
|
} else {
|
||||||
|
int w, h;
|
||||||
|
|
||||||
|
SDL_GetRendererOutputSize(renderer, &w, &h);
|
||||||
|
data->glViewport(renderer->viewport.x, (h - renderer->viewport.y - renderer->viewport.h),
|
||||||
|
renderer->viewport.w, renderer->viewport.h);
|
||||||
|
}
|
||||||
|
|
||||||
data->glMatrixMode(GL_PROJECTION);
|
data->glMatrixMode(GL_PROJECTION);
|
||||||
data->glLoadIdentity();
|
data->glLoadIdentity();
|
||||||
if (renderer->viewport.w && renderer->viewport.h) {
|
if (renderer->viewport.w && renderer->viewport.h) {
|
||||||
if (!renderer->target) {
|
if (renderer->target) {
|
||||||
data->glOrtho((GLdouble) 0,
|
data->glOrtho((GLdouble) 0,
|
||||||
(GLdouble) renderer->viewport.w,
|
(GLdouble) renderer->viewport.w,
|
||||||
(GLdouble) 0,
|
(GLdouble) 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user