How does glutReshapeFunc work?

I found this piece of code:

void reshape (int w, int h) {
glViewport (0, 0, (GLsizei)w, (GLsizei)h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
gluPerspective (60, (GLfloat)w / (GLfloat)h, 0.1, 100.0);
glMatrixMode (GL_MODELVIEW);

int main (int argc, char **argv) {
glutInit (&argc, argv);
glutInitDisplayMode (GLUT_DOUBLE);
glutInitWindowSize (640, 480);
glutInitWindowPosition (100, 100);
glutCreateWindow ("Ellipses");

glutDisplayFunc (display);
glutIdleFunc (display);
glutReshapeFunc (reshape);
glutMainLoop ();
return 0;

how does the call to reshape work, what are the values of w and h in this case ???

See documentation for glutReshapeFunc. Like all the glut*Func() functions this registers a callback function, a function that is called in response to a window system/OS event, so that your application has a chance to handle it appropriately.

Please use [ code]/[ /code] (without space after ‘[’) around source code snippets, see also Forum Posting Guidelines, thanks.