glutDisplayFunc
glutDisplayFunc is a function in the OpenGL Utility Toolkit (GLUT) used to register the display callback for the current window. The display callback is called by GLUT whenever the window needs to be redrawn, such as after creation, when it is exposed, or when a redraw is requested programmatically.
Prototype and behavior: void glutDisplayFunc(void (*func)(void)); The argument is a pointer to a function that takes
Usage: After creating a window with glutCreateWindow and configuring the display mode with glutInitDisplayMode, assign the
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glutSwapBuffers(); // if using GLUT_DOUBLE
}
int main(int argc, char** argv) {
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
}
Notes: The display callback is central to rendering in GLUT and is invoked in response to internal