Reputation: 51
I want to call the glutDisplayFunc function again in loop but it's error. How to solve this problem?
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB);
glutInitWindowSize(1000, 1000);
glutInitWindowPosition(0, 0);
glutCreateWindow("simple");
for (int m = 0; m <= l; m++) {
cout << "Please enter a stage: ";
cin >> num;
glutDisplayFunc(display);
}
initializeGL();
glutMainLoop();
Upvotes: 2
Views: 1426
Reputation: 22165
glutDisplayFunc
does not call the function you pass to it itself. It basically stores which function should be called inside the glutMainLoop()
.
In the glut main-loop the rendering function is then called whenever necessary. If you want it to redraw as fast as possible, call glutPostRedisplay();
at the end of the display function.
Upvotes: 4