GLFW Toggling Windowed-Fullscreen Mode

允我心安 提交于 2019-12-08 19:11:37

问题


I am using GLFW and I would like to know how to toggle full-screen windowed mode. Not changing the resolution, but instead setting the window to be on top and without decoration. If GLFW is not capable of doing this, then what cross platform library do you suggest to achieve this?


回答1:


You can tell glfw to open your window fullscreen.

glfwOpenWindow( width, height, 0, 0, 0, 0, 0, 0, GLFW_FULLSCREEN )

As far as I know you would have to close and reopen this window to switch between a window and fullscreen mode.




回答2:


To avoid GLFW changing the screen resolution, you can use glfwGetDesktopMode to query the current desktop resolution and colour depth and then pass those into 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:


Since version 3.2:

Windowed mode windows can be made full screen by setting a monitor with glfwSetWindowMonitor, and full screen ones can be made windowed by unsetting it with the same function.

http://www.glfw.org/docs/latest/window.html



来源:https://stackoverflow.com/questions/10253283/glfw-toggling-windowed-fullscreen-mode

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