我正在尝试编译并运行此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的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.
最佳答案 我得到这样的错误:
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)解决了这个问题
希望这可以帮助!