Tutorial Exercise 1

advertisement
Tutorial Exercise 1
CS3162 Introduction to Computer Graphics
Helena Wong, 2000
1. Do you understand each of the followings:
r Frame
_________________________________________________
r Frame rate
_________________________________________________
r Pixel
_________________________________________________
r Bitmap
_________________________________________________
r 24-bits per pixel _________________________________________________
2. The coloring in computer images is the same as the composition of lights. Try to guess the
composition of :
Result Color
Red
White
Black
Yellow
Pink
Purple
Color level of each channel
Red
Green
Blue
255
0
0
3. What are the purposes of a screen saver. Which one is most important?
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
4. Consider 3 different raster systems with resolutions of 640x480, 1280x1024, 2560x2048. What
size frame buffer (in bytes) is needed for each of these systems to store 12 bits per pixel? How
much storage is required for each system if 24 bits per pixel are to be stored?
5. Consider a raster system with resolution of 640x480. How many pixels could be accessed per
second in this system by a display controller that refreshes the screen at a rate of 60 frames per
second? What is the access time per pixel in this system?
6. What is the fraction of the total refresh time per frame spent in retrace of the electron beam for a
noninterlaced raster system with a resolution of 1280x1024, a refresh rate of 60 Hz, a horizontal
retrace time of 5 microseconds, and a vertical retrace time of 500 microseconds?
1
Tutorial Exercise 1
CS3162 Introduction to Computer Graphics
Helena Wong, 2000
7. Try to compile and run a Visual C++ program. The things you learn in this exercise will also be
applied in the assignments which will be given to you later on.
1. Create a directory in the hard disk named "c:\temp\Tut1". If there is already such a directory,
remove it and re-create. Download the sample VC++ program files into this directory from
www.cs.cityu.edu.hk\~helena
2. Start the Visual C++ program from Start Menu \ Microsoft Visual Studio.
3. In VC++, use the File \ Open Workspace command to open the "tut1.dsw" project file in
"c:\temp\Tut1".
4. In VC++, use the Build \ Build tut1.exe command to compile the program files into an
executable "tut1.exe" file, which will be located in the directory "c:\temp\Tut1\Debug".
5. In VC++, use the Build \ Execute Tut1.exe command to run this program.
6. Instead of step 5, you can also invoke "Tut1.exe" from windows explorer by switching to this
"c:\temp\Tut1\Debug" directory and double click the "Tut1.exe" file.
7. In VC++, use the Build \ Set Active Configuration command to select Win32 Release
configuration, then, the next time you compile the executable "Tut1.exe" file, this "Tut1.exe"
file will be located in the "c:\temp\Tut1\Release" directory. Note that this Win32 Release
configuration gives you much smaller file size of the executable "Tut1.exe" file. However,
the default Win32 Debug configuration, though generating a bigger "Tut1.exe" file, can
allow you to do debugging tasks (you may try the Build \ Start Debug command for these
debugging tools)
8. In the Workspace window, select FileView page, double click the "Painting.cpp" file under
Source Files in this FileView page. Try to understand the content of the DoPainting
function in this "Painting.cpp" file.
Workspace
window
Select
FileView
page
9. Try to modify this DoPainting function to show some other dots or lines in different color.
Repeat step 4 and 5 for testing.
10. In the Workspace window, select the ResourceView page. Under Tut1 resources, double
click IDB_BITMAP2 under Bitmap. Modify this picture. Repeat step 4 and 5 for testing.
11. Right click IDB_BITMAP2 and select Insert Bitmap to create a new bitmap called
IDB_BITMAP3. Draw something in this bitmap.
12. Switch to the "Painting.cpp" file as in Step 8. Modify the code in the DoPainting function so
that it also paints IDB_BITMAP3. Repeat step 4 and 5 for testing.
2
Related documents
Download