170 likes | 185 Views
This lecture explores the concepts of drawing figures on the computer screen using the framebuffer, including the viewport, pixel arrays, color buffers, and depth buffers. It also discusses typical screen sizes and how computer monitors handle colors.
E N D
Chapter 2 Getting Started: Drawing Figures
The Framebuffer Lecture 2 Fri, Aug 29, 2003
The Viewport • The viewport is the computer screen. • More specifically, it is the portion that is inside the program’s window. • It consists of a rectangular array of pixels. • Typical screen sizes • 800 x 600 • 1024 x 768 • 1280 x 1024 • 1600 x 1200
Pixels • Black and White Monitors • Each pixel is either black or white, or • Each pixel produces a single gray level determined by the brightness of the pixel. • Color Monitors • Each pixel has three components (red, green, blue) that together determine the color and brightness.
The Framebuffer • The framebuffer consists of several buffers. • The color buffer. • The depth buffer. • The stencil buffer. • The accumulation buffer. • Not every computer has all of these buffers.
The Color Buffer • We will use only the color buffer and the depth buffer. • Most color buffers contain 3 bytes per pixel. • 1 byte for each of the colors red, green, and blue. • The depth buffer contains one 32-bit floating-point value per pixel.
The Color Buffer • On many computers the color buffer includes an additional byte representing opaqueness. • This value is called “alpha.” • = 1.0 – completely opaque. • = 0.0 – completely transparent.
The Color Buffer • For a simple black and white monitor, only one bit per pixel is required. • 1 bit: 0 = black, 1 = white. • Or there could be gray levels. • 4 bits: 16 gray levels. • 8 bits: 256 gray levels.
The Color Buffer • Color monitor. • 16 bits: red (5 bits), green (6 bits), blue (5 bits). • 216 = 65536 colors. • 24 bits: red, green, blue (8 bits each). • 224 = 16 million colors.
Example • A picture
The Color Buffer • On most LCD displays and on many monitors, a color pixel consists of three separate colors.
The Color Buffer • The standard on most computers is 24 color bits per pixel. • Framebuffer size. • 800 x 600 = 480000 pixels = 1.4 Mb. • 1024 x 768 = 786432 pixels = 2.3 Mb. • 1280 x 1024 = 1310720 pixels = 3.8 Mb. • 1600 x 1200 = 1920000 pixels = 5.6 Mb.
The Color Buffer • To store a movie with 60 frames per second would require from 5 to 20 gigabytes of storage for every one minute of the movie. • How is it possible to store a two-hour movie on a DVD?
The Framebuffer • Most computers provide a double buffer. • While one buffer is displayed, the next frame is being drawn in the other buffer. • This techniques eliminates flicker in animations. • It also doubles the memory requirements.
The Framebuffer • Requirements of the framebuffer memory. • Very fast, and therefore very expensive. • Able to refresh the screen independently of the CPU at 60 fps.