src/render/opengl/SDL_render_gl.c
changeset 7995 0eed14683885
parent 7992 6558e2b68c03
child 8093 b43765095a6f
equal deleted inserted replaced
7994:37c48b4ecb0c 7995:0eed14683885
   917     if (SDL_CurrentContext != data->context) {
   917     if (SDL_CurrentContext != data->context) {
   918         /* We'll update the viewport after we rebind the context */
   918         /* We'll update the viewport after we rebind the context */
   919         return 0;
   919         return 0;
   920     }
   920     }
   921 
   921 
   922     data->glViewport(renderer->viewport.x, renderer->viewport.y,
   922     if (renderer->target) {
   923                      renderer->viewport.w, renderer->viewport.h);
   923         data->glViewport(renderer->viewport.x, renderer->viewport.y,
       
   924                          renderer->viewport.w, renderer->viewport.h);
       
   925     } else {
       
   926         int w, h;
       
   927 
       
   928         SDL_GetRendererOutputSize(renderer, &w, &h);
       
   929         data->glViewport(renderer->viewport.x, (h - renderer->viewport.y - renderer->viewport.h),
       
   930                          renderer->viewport.w, renderer->viewport.h);
       
   931     }
   924 
   932 
   925     data->glMatrixMode(GL_PROJECTION);
   933     data->glMatrixMode(GL_PROJECTION);
   926     data->glLoadIdentity();
   934     data->glLoadIdentity();
   927     if (renderer->viewport.w && renderer->viewport.h) {
   935     if (renderer->viewport.w && renderer->viewport.h) {
   928         if (!renderer->target) {
   936         if (renderer->target) {
   929             data->glOrtho((GLdouble) 0,
   937             data->glOrtho((GLdouble) 0,
   930                           (GLdouble) renderer->viewport.w,
   938                           (GLdouble) renderer->viewport.w,
   931                           (GLdouble) 0,
   939                           (GLdouble) 0,
   932                           (GLdouble) renderer->viewport.h,
   940                           (GLdouble) renderer->viewport.h,
   933                            0.0, 1.0);
   941                            0.0, 1.0);