GLFW 找不到监视器

GLFW not finding monitors

我一直在从事一个项目并将 GLFW 用作 windowing 系统。最近,我尝试实现全屏。通过阅读文档,我发现您需要调用 glfwCreateWindow(),第四个参数是您想要 window 全屏显示的监视器。我做了这样的事情:

glfwInit();
...

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

...

但是 window 不是全屏。经过一些测试后,我确定 glfwGetPrimaryMoniter() 正在返回 0。我不知道这是否重要,但我在笔记本电脑上 windows 10。如果有人能提供帮助,那就太好了。

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

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