2012-04-20 585 views
7

我正在使用GLFW,我想知道如何切換全屏窗口模式。不改變分辨率,而是將窗口設置在最上面而沒有裝飾。如果GLFW無法做到這一點,那麼您建議實現這一目標的跨平臺庫是什麼?GLFW切換窗口全屏模式

回答

6

你可以告訴glfw全屏打開你的窗口。

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

據我所知,你將不得不關閉並重新打開此窗口的窗口和全屏模式之間進行切換。

+0

或者,如果你想從'GLFW_WINDOW'切換到'GLFW_FULLSCREEN'你第一次打開新的人之前必須clode窗口。 – danijar 2012-08-25 09:16:41

3

爲避免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 
} 
+0

這非常有幫助!這+看glfw的源代碼:-) – netpoetica 2013-09-22 23:27:17