2016-01-28 28 views
0

我一直在做一個項目,並使用GLFW作爲窗口系統。最近,我試圖實現全屏。從閱讀文檔,我發現你需要調用glfwCreateWindow(),第四個參數就是你想讓窗口全屏顯示的顯示器。我做了這樣的事情:GLFW沒有找到顯示器

glfwInit(); 
... 

glfwCreateWindow(windowWidth, windowHeight, "MyWindow", glfwGetPrimaryMoniter(), nullptr); 

... 

但窗口是不是全屏。經過一些測試後,我確定glfwGetPrimaryMoniter()返回0.我不知道它是否重要,但我在一臺帶有Windows 10的筆記本電腦上。如果有人能幫上忙,那會很棒。

+0

[檢查是否發生錯誤(http://www.glfw.org/docs/latest/intro.html#error_handling) –

+0

我已經嘗試過的錯誤回調,從來沒有得到所謂的 – DrCoco

+0

@DrCoco我知道已經晚了,但請檢查我的答案,如果你還需要這個嗎? –

回答

0

在創建窗口的上下文之後調用GLContext.createFromCurrent()。

GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", glfwGetPrimaryMonitor(), NULL); 
glfwMakeContextCurrent(window); 
GLContext.createFromCurrent();