Get screen resolution programmatically in OS X

I would like to run a full-screen 3D C ++ application in native resolution on a Mac. How to get the original screen resolution?

+7
source share
1 answer

If you do not want to use Objective-C, get the identifier of the display you want to display (using, for example, CGMainDisplayID ), then use CGDisplayPixelsWide and CGDisplayPixelsHigh to get the width and height of the screen in pixels. See " Retrieving Display Information" for other display information.

If you want to use a little Objective-C, just use the [[NSScreen mainScreen] frame] .

Please note that there are other problems with full screen display, namely that other applications do not do the same. Read " Drawing in full screen " in the Apple OpenGL Programming Guide for more details.

+10
source

All Articles