Our registered reshape function is called when the device window is initially constructed and each time the user resizes the window. GLUT passes to our function the width and height of the current device window. We store these values in our struct variable deviceWindow. They are needed to compute the coordinates of the point in the projection window when the user clicks on a point in the device window.

We also set here the viewport since we registered a reshape function. Recall that OpenGL sets the viewport to the default one, namely, the entire canvas UNLESS we register a reshape function and then we must handle it in our code.