Re: Detect a Retina display
Re: Detect a Retina display
- Subject: Re: Detect a Retina display
- From: Scott Ribe <email@hidden>
- Date: Thu, 20 Jun 2013 08:14:56 -0600
On Jun 20, 2013, at 7:49 AM, Thierry Cantet wrote:
> Hello !
>
> I have a quick question concerning Retina displays.
> My software uses OpenGL for displaying the pixels. However, on a Retina screen, OpenGL behaves strangely.
>
> There is a fix ( https://developer.apple.com/library/mac/#documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/CapturingScreenContents/CapturingScreenContents.html#//apple_ref/doc/uid/TP40012302-CH10-SW1 ) that requires you to use :
>
> NSRect backingBounds = [self convertRectToBacking:[self bounds]];
> GLsizei backingPixelWidth = (GLsizei)(backingBounds.size.width),
> backingPixelHeight = (GLsizei)(backingBounds.size.height);
> glViewport(0, 0, backingPixelWidth, backingPixelHeight);
>
> inside the drawRect method.
>
> The main issue is, the /convertRectToBacking/ method exists only since OS X 10.7, and my software still supports OS X 10.6 (so I need to build it with a 10.6 SDK, and not 10.7).
> I could drop the 10.6 support, but that is not an option for now.
>
> I have looked for another way, and I found the /backingScaleFactor/ method (it returns the scale factor, which is 2 for Retina displays, and 1 for other screens). But then again, this method is available only from 10.7.
>
> So, my question is, is there any way of detecting a Retina display, but usable with 10.6 ?
>
> Thanks in advance :)
if ([self respondsToSelector: @selector(convertRectToBacking:)]) {
GLsizei backingPixelWidth = (GLsizei)(backingBounds.size.width)...
--
Scott Ribe
email@hidden
http://www.elevated-dev.com/
(303) 722-0567 voice
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden