Fixed bug #1112 (retina display support)
authorSam Lantinga <slouken@libsdl.org>
Tue, 01 Feb 2011 08:54:34 -0800
changeset 5130ec13e48ee0d9
parent 5129 5690ebc772c7
child 5131 7b7da52e8775
Fixed bug #1112 (retina display support)

Vittorio Giovara 2011-02-01 02:21:50 PST

with the attached patch, the opengles context will always use the maximum
screensize available; this is particularly useful for supporting retina display
on latest iphone.

please note: Apple documentation warns that using the "upscaled" gl context
actually uses more memory and bandwitdh, so it might be worth to let the user
decide whether to disable it or not, either with a flag or a sdl function...
src/video/uikit/SDL_uikitopenglview.m
     1.1 --- a/src/video/uikit/SDL_uikitopenglview.m	Tue Feb 01 08:53:22 2011 -0800
     1.2 +++ b/src/video/uikit/SDL_uikitopenglview.m	Tue Feb 01 08:54:34 2011 -0800
     1.3 @@ -116,6 +116,10 @@
     1.4              return NO;
     1.5          }
     1.6          /* end create buffers */
     1.7 +
     1.8 +        /* Use the main screen scale (for retina display support) */
     1.9 +        if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
    1.10 +            self.contentScaleFactor = [UIScreen mainScreen].scale;
    1.11      }
    1.12      return self;
    1.13  }