Okay, don't panic. It's simpler than it looks. Looking at

genNextRect, it takes the width and height of a rectangle as global parameters,gla2andglb2, and sets them to the next smallest golden rectangle. Note,genNextRectassumes thegla2andglbare already a golden rectangle. This is done by taking one of the dimensions and dividing by the golden ratio, which will result in a smaller length. Theflipflag determine which dimension to shorten. It is the side with the longest length that is shortened. You will need to keep track offlipsuch that, whengenNextRectis called, that the longest length of the rectangle is shortened. Alternatively, you could removeflipentirely and change the condition ingenNextRectto select the longer edge. You may want to check that your rectangle's aspect ratio matches (or is close enough to) the golden ratio after callinggenNextRect.

After you have calledgenNextRectyou will need to draw it as demonstrated in theglBegin/glEndblock indisplay. The assignment requires you continue drawing rectangles until the rectangles are too small to display. So, all that's left to complete the assignment is finding the first golden rectangle in the screen and a loop that callsgenNextRectand draws the new rectangle until the rectangle is too small to display.

P.S.

Don't panic.

Spoiler

thank you very much. I will do this with your help