erai
erai

Reputation: 185

GLFW Toggling Windowed-Fullscreen Mode

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?

Upvotes: 7

Views: 7697

Answers (3)

bwroga
bwroga

Reputation: 5459

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

Upvotes: 2

james
james

Reputation: 91

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
}

Upvotes: 4

user789805
user789805

Reputation: 94

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.

Upvotes: 6

Related Questions