Programmatically change resolution OS X

五迷三道 提交于 2019-12-04 14:17:03

问题


My question is simple. I am developing a game and, as the title states, I want to be able to programmatically change the display resolution / refresh rate on OS X. I've been searching for this for hours and couldn't find anything. I already know how to create a full screen window.

I would also want to get the list of supported resolutions and refresh rates


回答1:


From Apple's OpenGL Programming Guide for Mac OS X: Drawing to the Full Screen:

Avoid changing the display resolution from that chosen by the user. If your application needs to render data at a lower resolution for performance reasons, you can explicitly create a back buffer at the desired resolution and allow OpenGL to scale those results to the display. See “Controlling the Back Buffer Size.”

That said, if you really want to do this, you can use Quartz Display Services. See "Changing Display Modes". You should really capture the display, as described elsewhere in that guide, before changing the display configuration or else other applications will have their windows moved and resized and your users will be annoyed. (For example, their desktop icons may get rearranged.)



来源:https://stackoverflow.com/questions/10596489/programmatically-change-resolution-os-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!