ECE660 Interactive Computer Graphics Spring, 2003

 Project #0
                                   Window Wonderland.

Due on-campus: Monday Feb 24th; For NTU/ VIP: 2 weeks or so after receipt.

Phase 1: (Do this in one week, by Wed. Sept.29 - but you nned not hand in anything separate for this phase):
Obtain the Sample OpenGL application hlPolys.cpp here, and get it running on your system. (You might also try the enhanced version, hlPolys2.cpp, that uses the GLUI and does the gingerbread man.) Adjust it so that you can reshape the window and neither clip nor distort a polyline drawing: (i.e. a reshape event alters the viewport used by OpenGL to match the aspect ratio of the drawing.)

Phase 2: Write an application that supports at least the following functionality.

At start-up a screen window is opened, showing a large "drawing area", with four small icons at the bottom. These icons are miniature versions of three "polyline figures" as described below, and one procedural figure.

The user interacts with the application using both the mouse and keyboard.

The main events, and their responses:

1). Event: The mouse is clicked inside one of the icons. Response: The figure associated with the icon becomes the "current object"; the current object is drawn in the drawing area, as large as possible with no distortion. (The drawing area is not erased by this action, so the new figure is drawn over whatever is currently in the drawing area.)

2). Event: The mouse is clicked two times inside the drawing area to specify an aligned rectangle R. Response: The drawing area is erased; the current object and rectangle R are redrawn; the portion of the figure that lies in R is drawn, expanded to as large a size as fits inside the drawing area without distortion. (If the user only clicks once before doing some other action such as pressing a key or clicking outside the drawing area, the first click is forgotten.)

3). Event: The user reshapes the screen window by dragging the lower right corner with the mouse. Response: The window is erased and the current object is redrawn as large as possible in the new drawing area (without distortion, of course).

4). Event: A key is pressed:

'e': Response: the drawing area is erased; the icons are redrawn.

'n': Response: the user is pormpted to type a new value for numTileColumns, the number of columns for the tiling. (Default number of columns = 6). The display doesn't change.

't': Response: The drawing area is tiled with non-distorted copies of the current object, scaled so that there are numTileColumns columns, and as many rows as fit vertically in the drawing area.(If the bottom row of tiles doesn't fit, leave it undrawn.)

esc: Response: The program terminates.

Discussion.



GRS figures.
The figures are polyline figures stored in files in the GRS (short for "gross") format. Use several of the .grs files available on the course FTP site in the POLYLINES directory. This format consists of:
a). a number of comment lines, followed by a line starting with at least one asterisk: '*'.
b). The "extent" of the figure: (left, top, right, bottom).
c). The number of polylines in the figure.
d). The list of polylines: eash starts with the number of points in the polyline, followed by the (x, y) pairs for each point.


The procedural figure.
This figure is not stored in a file; instead it is regeneratead each time it is drawn. Choose which figure to use as your procedural figure from the set: a). an interesting polyspiral; b). a 17-rosette; c); the sierpinski gasket; d). an interesting polyflake.


Extra Credit: (15 points maximum total)
a). Create at least two interesting GRS files, and use them in your program. Be creative!
b). Add the keystroke: 'h' : Tilings are drawn with alternate figures flipped horizontally.
c). Add the keystroke 'r': This toggles between two modes: the unrotated and the rotated modes. The unrotated mode is what you worked in above. In the rotated mode, the current figure is displayed rotated 90 degrees CCW in the largest drawing area (having the proper aspect ratio for no distortion). If the user clicks on the rotated figure to define a zoom window, the portion in the window is drawn (as large as possible) in the drawing area, in its rotated orientation.
d). Alter the response to Event #2 so that when the user denotes rectangle R when an enlarged version of the current object is displayed, the portion of the enlarged object inside R is further enlarged to fill the drawing area.


(Note: Work in groups of two if you wish. If you do, you must do all of the extra credit parts. Turn in a single report with both your names on it.)

Hand in:
1. Brief instructions (hard copy) on how to use your program.
2. A complete listing (on paper) of the program code, with proper documentation. Highlight features you want to draw to our attention.
3. A diskette containing your source code and all GRS data files your program uses.
4. For PC  users, put the executable file on the diskette, so that your program runs by just double clicking on it. (For on-campus unix/XWindows users: come to my office and demonstrate your program working. For VIP/NTU unix/Xwindows users, we will work out the details by email.)

Note to NTU/VIP students: Please do not email or FAX in your projects. Send in paper version and diskette by surface mail.