【发布时间】:2012-05-02 10:55:51
【问题描述】:
我正在使用 GLFW,我想知道如何切换全屏窗口模式。不改变分辨率,而是将窗口设置在顶部并且没有装饰。如果 GLFW 无法做到这一点,那么您建议使用什么跨平台库来实现这一点?
【问题讨论】:
标签: cross-platform glfw
我正在使用 GLFW,我想知道如何切换全屏窗口模式。不改变分辨率,而是将窗口设置在顶部并且没有装饰。如果 GLFW 无法做到这一点,那么您建议使用什么跨平台库来实现这一点?
【问题讨论】:
标签: cross-platform glfw
你可以告诉 glfw 全屏打开你的窗口。
glfwOpenWindow( width, height, 0, 0, 0, 0, 0, 0, GLFW_FULLSCREEN )
据我所知,您必须关闭并重新打开此窗口才能在窗口和全屏模式之间切换。
【讨论】:
GLFW_WINDOW切换到GLFW_FULLSCREEN你必须在打开新窗口之前先关闭窗口。
为避免 GLFW 更改屏幕分辨率,您可以使用 glfwGetDesktopMode 查询当前桌面分辨率和颜色深度,然后将它们传递给 glfwOpenWindow。
// get the current Desktop screen resolution and colour depth
GLFWvidmode desktop;
glfwGetDesktopMode( &desktop );
// open the window at the current Desktop resolution and colour depth
if ( !glfwOpenWindow(
desktop.Width,
desktop.Height,
desktop.RedBits,
desktop.GreenBits,
desktop.BlueBits,
8, // alpha bits
32, // depth bits
0, // stencil bits
GLFW_FULLSCREEN
) ) {
// failed to open window: handle it here
}
【讨论】:
从 3.2 版开始:
窗口模式窗口可以通过设置监视器来全屏显示 使用glfwSetWindowMonitor,全屏可以窗口化 通过使用相同的功能取消设置。
【讨论】: