|
EXERCISES FOR WEEK 2
|
| week2-1 |
Use the demo program horiz_stripes3.cpp as a guide to write a display function that draws vertical stripes instead of horizontal stripes.
|
| week2-2 |
Now put the horizontal stripes and vertical stripes together in the same program, using multiple windows. Have one window display horizontal stripes and a second window display vertical stripes. |
| week2-3 |
Add a third window to the program you wrote in exercise 2 so that it displays a "checkerboard".
|
| week2-4 |
Suppose you have called glOrtho(0.0, 10.0, 0.0, 6.0, -1.0 1.0) and you are using the default viewport (entire screen window). The screen window width is 600 pixels (0 to 599) and its height is 400 pixels (0 to 399).
|
| week2-5 |
Suppose you have called glOrtho(-10.0, 10.0, -6.0, 6.0, -1.0, 1.0) and you are using the default viewport (entire screen window). The screen window width is 600 pixels (0 to 599) and its height is 400 pixels (0 to 399).
|
| week2-6 |
What is the aspect ratio of the real window frame defined in the previoius exercise? If you are still using the default viewport,
|
| week2-7 |
If you want to preserve the aspect ratio of the real window frame defined in exercise 5, but must use a square screen window (800 by 800 pixels), what values would you use for left, bottom, width, height in the call to
so that the viewport is centered both vertically and horizontally in the screen window and uses as much of the window as possible?
|
| week2-8 |
Re-do exercise 7 using the real window frame defined by:
|
| week2-9 | Suppose your real world window
frame is given by Frame.Left, Frame.Right, Frame.Bottom, and Frame.Top
and the values for width and height of the screen window are given by
ScreenWindow.Width and ScreenWindow.Height. If the default
viewport is used (the frame is mapped to the entire window), what is
the real value (in terms of the real frame setting) for the pixel
values (x,y) returned by the mouse click. In other words, to what
point in your real window on your graph paper does the mouse click
correspond? |
| week2-10 |
Test your answer to previous exercise with this case:
|
| week2-11 |
Regarding exercise 2-10, what will be the coordinates of the viewport within the screen window if we choose a viewport that preserves the aspect ratio of the real frame and is centered within the screen window? Test your answer to exercise 3 by choosing this viewport with the window and mouse info given in the test case in exercise 2. |