Detect a Retina display
Detect a Retina display
- Subject: Detect a Retina display
- From: Thierry Cantet <email@hidden>
- Date: Thu, 20 Jun 2013 15:49:18 +0200
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