【发布时间】:2022-01-05 21:00:49
【问题描述】:
我正在尝试使用 openGL 和 C 运行这个简单的 hello world 程序。 我在 Windows 上的 debian 子系统中运行它,我认为这是问题的一部分。
Main.c:
#include<stdio.h>
#include<GL/glut.h>
void displayMe(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glVertex3f(0.5, 0.0, 0.5);
glVertex3f(0.5, 0.0, 0.0);
glVertex3f(0.0, 0.5, 0.0);
glVertex3f(0.0, 0.0, 0.5);
glEnd();
glFlush();
}
int main(int argc, char** argv){
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE);
glutInitWindowSize(400, 300);
glutInitWindowPosition(100, 100);
glutCreateWindow("Hello world!");
glutDisplayFunc(displayMe);
glutMainLoop();
return 0;
}
但我收到此错误:
freeglut (./firstOpenGlApp): failed to open display ''
【问题讨论】:
标签: c opengl debian windows-subsystem-for-linux freeglut