更新 GLEW 后,window 变成了黑色
After updating GLEW, the window became only black
将 debian 从 stretch 升级到 buster 并将 GLEW
从 2.0.0-3
更新到 2.1.0-2
后,我的应用程序停止工作。更准确地说,只有黑屏是可见的。着色器编译成功,但仅此而已。以下是我程序的代码摘录:
void initGL() {
std::cout << "Starting GLFW context, OpenGL 3.3" << std::endl;
// Init GLFW
if (!glfwInit()) std::cout << "GLFW init failed";
// Set all the required options for GLFW
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_TRUE);
// Create a GLFWwindow object that we can use for GLFW's functions
window = FULLSCREEN == true ?
glfwCreateWindow(WIN_W, WIN_H, "Algine", glfwGetPrimaryMonitor(), nullptr) :
glfwCreateWindow(WIN_W, WIN_H, "Algine", nullptr, nullptr);
glfwMakeContextCurrent(window);
// Set the required callback functions
glfwSetKeyCallback(window, key_callback);
glfwSetWindowSizeCallback(window, window_size_callback);
// Set this to true so GLEW knows to use a modern approach to retrieving function pointers and extensions
// glewExperimental = GL_TRUE;
// Initialize GLEW to setup the OpenGL Function pointers
if (glewInit() != GLEW_NO_ERROR) std::cout << "GLEW init failed\n";
glEnable(GL_DEPTH_TEST);
glDepthMask(true);
//glCullFace(GL_BACK);
}
渲染:
while (!glfwWindowShouldClose(window)) {
currentTime = glfwGetTime();
frameCount++;
// If a second has passed.
if (currentTime - previousTime >= 1.0) {
// Display the frame count here any way you want.
std::cout << frameCount << " fps\n";
frameCount = 0;
previousTime = currentTime;
}
// Check if any events have been activiated (key pressed, mouse moved etc.) and call corresponding response functions
glfwPollEvents();
display();
glfwSwapBuffers(window);
}
我正在使用 Debian Buster;我的应用程序中的 GLFW + GLEW
知道问题出在哪里吗?非常感谢您的帮助!
更新: 将系统回滚到 Debian Stretch。之后,我手动将 glew
更新为 2.1.0-2
版本(在 Buster 上),一切正常。如果问题不在驱动程序中,不在我使用的库中,那么它会在 Debian Buster 本身中出现吗?
问题已解决。事实证明,问题出在新 glm
中。我手动将 glm
版本从 0.9.9~a2-2
(Buster) 回滚到 0.9.8.3-3
(Stretch),一切都开始正常工作。
将 debian 从 stretch 升级到 buster 并将 GLEW
从 2.0.0-3
更新到 2.1.0-2
后,我的应用程序停止工作。更准确地说,只有黑屏是可见的。着色器编译成功,但仅此而已。以下是我程序的代码摘录:
void initGL() {
std::cout << "Starting GLFW context, OpenGL 3.3" << std::endl;
// Init GLFW
if (!glfwInit()) std::cout << "GLFW init failed";
// Set all the required options for GLFW
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_TRUE);
// Create a GLFWwindow object that we can use for GLFW's functions
window = FULLSCREEN == true ?
glfwCreateWindow(WIN_W, WIN_H, "Algine", glfwGetPrimaryMonitor(), nullptr) :
glfwCreateWindow(WIN_W, WIN_H, "Algine", nullptr, nullptr);
glfwMakeContextCurrent(window);
// Set the required callback functions
glfwSetKeyCallback(window, key_callback);
glfwSetWindowSizeCallback(window, window_size_callback);
// Set this to true so GLEW knows to use a modern approach to retrieving function pointers and extensions
// glewExperimental = GL_TRUE;
// Initialize GLEW to setup the OpenGL Function pointers
if (glewInit() != GLEW_NO_ERROR) std::cout << "GLEW init failed\n";
glEnable(GL_DEPTH_TEST);
glDepthMask(true);
//glCullFace(GL_BACK);
}
渲染:
while (!glfwWindowShouldClose(window)) {
currentTime = glfwGetTime();
frameCount++;
// If a second has passed.
if (currentTime - previousTime >= 1.0) {
// Display the frame count here any way you want.
std::cout << frameCount << " fps\n";
frameCount = 0;
previousTime = currentTime;
}
// Check if any events have been activiated (key pressed, mouse moved etc.) and call corresponding response functions
glfwPollEvents();
display();
glfwSwapBuffers(window);
}
我正在使用 Debian Buster;我的应用程序中的 GLFW + GLEW
知道问题出在哪里吗?非常感谢您的帮助!
更新: 将系统回滚到 Debian Stretch。之后,我手动将 glew
更新为 2.1.0-2
版本(在 Buster 上),一切正常。如果问题不在驱动程序中,不在我使用的库中,那么它会在 Debian Buster 本身中出现吗?
问题已解决。事实证明,问题出在新 glm
中。我手动将 glm
版本从 0.9.9~a2-2
(Buster) 回滚到 0.9.8.3-3
(Stretch),一切都开始正常工作。