Im trying to run this simple hello world program with openGL and C. Im running this in a debian subsystem on windows and i think that is part of the problem.
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;
}
but i get this error:
freeglut (./firstOpenGlApp): failed to open display ''
It's looking for an X server. The DISPLAY var would normally be exported to ":0", however, given that this is on Windows, I doubt there is one available.
If xterm -display :0
does not work, you may be better off installing VirtualBox, and install a proper Linux distro within it.