Addr (X, Y) 1000 y + X

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Answers to CS3241 Tutorial 1, week 3

1.

Explain what is meant by the term OpenGL display callback function.


A callback function is a procedure that is to be invoked whenever a particular action occurs. Such
a procedure is registered by listing the procedure name in an appropriate OpenGL function.

2.

What command could we use to set the color of an OpenGL display window to light gray? What
command would we use to set the color of the display window to black?
We set the color of a display window to light gray by selecting a value between 0.5 and 1.0 and
assigning that value to all three RGB parameters in the glClearColor command. For example, we
can set the display window to light gray with
glClearColor (0.9, 0.9, 0.9, 0.0);
Similarly, we obtain black by selecting 0.0 for the RGB color components.

3.

Consider three different raster systems with resolutions of 640 by 480, 1280 by 1024, and 2560 by
2048. What size frame buffer (in bytes) is needed for each of these systems to store 12 bits per
pixel? How much storage is required fro each system if 24 bits per pixel are to be stored?
Frame-buffer size for each of the systems is
640 480 12 bits 8 bits per byte = 450 KB
1280 1024 12 bits 8 bits per byte = 1920 KB
2560 2048 12 bits 8 bits per byte = 7680 KB
For 24 bits of storage per pixel, each of the above values is doubled.

4.

Assuming that a certain full-color (24-bit-per-pixel) RGB raster system has a 512-by-512 frame
buffer, how many distinct color choices (intensity levels) would we have available? How many
different colors could we display at any one time?
Total number of available colors is 224 = 16, 777, 216. Using a different color for each screen
pixel, we could display 5122 = 262, 144 colors at any one time.

5.

Suppose you have a system with an 8 inch by 10 inch video monitor that can display 100 pixel per
inch. If memory is organized in one-byte words, the starting frame address is 0, and each pixel is
assigned one byte of storage, what is the frame buffer address of the pixel with screen coordinates
(x, y)?
The number of pixels that can be displayed for this system is 800 by 1000. Pixel positions are
numbered horizontally from 0 to 999 and vertically from 0 to 799. Then,
addr(x, y) = 1000 y + x
where the step from one pixel position to the next is one byte.

You might also like