CS 4204, Assignment 1 - Due February 6, 2007

Reshape Callback and Bitmapped Characters

Consider the program on the class web page that draws a white rectangle on a black background. When you run this program, you will notice that when you change the window size, the size of the white rectangle changes.

Make the necessary changes to the program so that when the screen window size is changed, the rectangle remains exactly the same size and stays in the same position relative to the bottom-left of the window. Make sure that when the screen window is partially or completely covered, the rectangle is redrawn correctly when the window is again uncovered.

Next change your program to draw a duplicate white rectangle to the right of and slightly higher than the first white rectangle. If your program is correct at this point, you will see both rectangles when the screen window is sufficiently enlarged.

Once you have gotten this to work correctly, write the size in pixels of the current screen window into the first white rectangle using a green font. To do this you first make a call to glRasterPos to position the lower left corner of the character in the world coordinate system (be careful here... note the coordinates of the white rectangle). Then you might use glutBitmapCharacter to draw characters. The fonts have names like GLUT_BITMAP_8_BY_13 and can be found in glut.h. Every time you draw a character, the drawing position is automatically advanced by the width of a character.

Submit your .c or .cpp source code by E-mailing it to Rongrong at by midnight the day it is due.