GLFW没有找到监视器

时间:2016-01-28 23:05:59

标签: c++ glfw

我一直致力于一个项目并使用GLFW作为窗口系统。最近,我试图实现全屏。通过阅读文档,我发现你需要调用glfwCreateWindow(),第四个参数是你希望窗口全屏显示的监视器。我做了这样的事情:

glfwInit();
...

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

...

但窗户并非全屏。经过一些测试后,我确定glfwGetPrimaryMoniter()返回0.我不知道这是否重要,但我在使用Windows 10的笔记本电脑上。如果有人能提供帮助那就太棒了。

1 个答案:

答案 0 :(得分:0)

在创建窗口的上下文后调用GLContext.createFromCurrent()。

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