在将debian从stretch升级到buster并将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本身吗?

最佳答案

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

关于linux - 更新GLEW之后,窗口变成只有黑色,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/53575203/

10-11 06:45