Re: Detect a Retina display
Re: Detect a Retina display
- Subject: Re: Detect a Retina display
- From: Richard Heard <email@hidden>
- Date: Fri, 21 Jun 2013 00:18:05 +1000
No retina devices can run 10.6, therefore you can safely assume 1.0.
This means you can use a runtime check for the selector, and if its not available default to a 1.0 multiple
eg:
> - (NSRect)backingBounds {
> if ([self respondsToSelector:@selector(convertRectToBacking:)]){
> return [self convertRectToBacking:self.bounds];
> }
> return self.bounds;
> }
-Richard
On 20/06/2013, at 11:49:18 PM, Thierry Cantet <email@hidden> 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 :)
>
> --
> Thierry CANTET
>
> _______________________________________________
>
> 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
_______________________________________________
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