更新GLEW之后,窗口变成只有黑色

时间:2018-12-01 21:25:48

标签: linux opengl debian glew debian-buster

在将debian从拉伸升级为破坏级并将GLEW2.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本身吗?

1 个答案:

答案 0 :(得分:3)

问题解决了。事实证明,问题出在新的glm中。我手动将glm版本从0.9.9~a2-2(Buster)回退到0.9.8.3-3(Stretch),一切开始正常运行。