这是我的简单代码。
#include <iostream>
#include <GLFW/glfw3.h>
int main() {
int count;
GLFWmonitor** monitors = glfwGetMonitors(&count);
std::cout << count << std::endl;
return 0;
}
出于某种原因,它一直告诉我有零监视器。我假设 0 表示确实有 1。但我的计算机上还连接了另外两台显示器。当我进入系统偏好设置时,我可以清楚地看到另外两个显示器。但我不知道为什么它一直告诉我零。我不知道会出现什么问题。
最佳答案
我猜你需要在做任何其他事情之前调用 glfwInit()
。
从 glfw 文档:
关于c++ - GLFW 获取监视器计数 = 0,另外两个监视器已连接,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22520706/