11

我正在尝试编译和运行这个 c++ 代码

#include <GL/glut.h>

void displayMe(void)
{
    glClear(GL_COLOR_BUFFER_BIT);
    glBegin(GL_POLYGON);
        glVertex3f(0.0, 0.0, 0.0);
        glVertex3f(0.5, 0.0, 0.0);
        glVertex3f(0.5, 0.5, 0.0);
        glVertex3f(0.0, 0.5, 0.0);
    glEnd();
    glFlush();
}

int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE);
    glutInitWindowSize(300, 300);
    glutInitWindowPosition(100, 100);
    glutCreateWindow("Hello world :D");
    glutDisplayFunc(displayMe);
    glutMainLoop();
    return 0;
}

这是我在网上找到的“opengl's hello world”。我这样做是为了测试我大学的 NVIDIA Tegra X1,TX1 开发套件始终开启并连接到大学的网络。我通过 ssh 连接到 TX1(使用 -X 标志)。编译很顺利,但是当我尝试运行程序时,出现了这个错误:

X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  154 (GLX)
  Minor opcode of failed request:  24 (X_GLXCreateNewContext)
  Value in failed request:  0x0
  Serial number of failed request:  29
  Current serial number in output stream:  30

我没有在网上找到任何东西,我不知道发生了什么。

PS:我首先通过 ssh(使用 -X)连接到我大学的网络,然后我执行另一个 ssh 连接到 TX1。

4

2 回答 2

9

我收到这样的错误:

X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  151 (GLX)
  Minor opcode of failed request:  24 (X_GLXCreateNewContext)
  Value in failed request:  0x0
  Serial number of failed request:  35
  Current serial number in output stream:  36
name of display: :99

在带有 nvidia 显卡的远程机器上。通过从 .run 文件安装 NVIDIA 驱动程序解决了这个问题,选项 --no-opengl-files (灵感来自这里:https ://gist.github.com/wangruohui/df039f0dc434d6486f5d4d098aa52d07 )

希望这可以帮助!

于 2018-07-30T12:48:03.677 回答
2

将我的用户添加到video组并重新启动为我解决了问题(来源)。glxgears现在也有效。还是要检查是否还有其他相关问题没有解决。

于 2021-11-10T20:57:29.307 回答