I'm trying to get started in learning how to make graphics with C.
#include <GL/glut.h>
int main(int argc, char **argv, char **envp) {
glutInit(&argc, argv);
glutCreateWindow("test");
glutMainLoop();
return 0;
}
This was compiled with gcc test.c -l glut
. Upon execution, the following error is printed: freeglut (./a.out): ERROR: No display callback registered for window 1
. What can be the cause of this, and what could be done to fix it?
You have to sets the display callback for the current window with glutDisplayFunc
before you enter the event processing loop with glutMainLoop
:
#include <GL/glut.h>
void display(void);
int main(int argc, char **argv, char **envp) {
glutInit(&argc, argv);
glutCreateWindow("test");
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
void display(void)
{
/* ... */
}