PDA

View Full Version : Using the retina display on a macbook pro



baerentzen
08-30-2012, 06:46 AM
Hi,

When I run a (GLUT based) OpenGL program on my retina MacBook Pro I get a window size relative to the 1440x900 resolution that is "simulated" on the retina display. That would be fine by me except that zooming in makes it clear that each pixel is actual four retina pixels, so OpenGL does not render at the true resolution.

Am I overlooking something simple?

Otherwise, I would be very interested in knowing if anyone has managed to get "retina OpenGL contexts" associated with windows and, in particular, if it is possible from GLUT (as I expect it isn't ... but who knows?). I expect I need to go with glKit?


Thanks!

Andreas

arekkusu
08-30-2012, 10:12 AM
Go to developer.apple.com and read "High Resolution Guidelines for OS X":
https://developer.apple.com/library/mac/#documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Introduction/Introduction.html

The "Enable OpenGL for High-Resolution Drawing" section will show you the -setWantsBestResolutionOpenGLSurface method added to NSOpenGLView.
This method is not accessible from GLUT. Or AGL.

baerentzen
08-31-2012, 01:56 AM
Thanks!

I downloaded the CocoaGL sample from https://developer.apple.com/library/mac/#samplecode/CocoaGL/Introduction/Intro.html

and inserted

[self setWantsBestResolutionOpenGLSurface:YES];

as the first statement in the method

- (void) prepareOpenGL

That worked like a charm, and the actual resolution is now exploited on the retina display.

Now ... I just need to use Cocoa for my projects instead of glut.