380 likes | 504 Views
310482: Graphics Programming. Seree Chinodom seree@buu.ac.th http://www.compsci.buu.ac.th/~seree/lecture/310482. Display Technologies. Cathode Ray Tubes (CRTs) Most common display device today Evacuated glass bottle Extremely high voltage Heating element (filament)
E N D
310482: Graphics Programming Seree Chinodom seree@buu.ac.th http://www.compsci.buu.ac.th/~seree/lecture/310482 9/6/2014
Display Technologies • Cathode Ray Tubes (CRTs) • Most common display device today • Evacuated glass bottle • Extremely high voltage • Heating element (filament) • Electrons pulled towards anode focusing cylinder • Vertical and horizontal deflection plates • Beam strikes phosphor coating on front of tube 9/6/2014
Electron Gun • Contains a filament that, when heated, emits a stream of electrons • Electrons are focused with an electromagnet into a sharp beam and directed to a specific point of the face of the picture tube • The front surface of the picture tube is coated with small phospher dots • When the beam hits a phospher dot it glows with a brightness proportional to the strength of the beam and how often it is excited by the beam 9/6/2014
Display Technologies: CRTs • Vector Displays • Early computer displays: basically an oscilloscope • Control X,Y with vertical/horizontal plate voltage • Often used intensity as Z • Name two disadvantages Just does wireframe Complex scenes visible flicker 9/6/2014
Display Technologies: CRTs • Raster Displays • Raster: A rectangular array of points or dots • Pixel: One dot or picture element of the raster • Scan line: A row of pixels 9/6/2014
Display Technologies: CRTs • Raster Displays • Black and white television: an oscilloscope with a fixed scan pattern: left to right, top to bottom • To paint the screen, computer needs to synchronize with the scanning pattern of raster • Solution: special memory to buffer image with scan-out synchronous to the raster. We call this the framebuffer. 9/6/2014
Display Technologies: CRTs • Phosphers • Flourescence: Light emitted while the phospher is being struck by electrons • Phospherescence: Light emitted once the electron beam is removed • Persistence: The time from the removal of the excitation to the moment when phospherescence has decayed to 10% of the initial light output 9/6/2014
Display Technologies: CRTs • Raster Displays • Frame must be “refreshed” to draw new images • As new pixels are struck by electron beam, others are decaying • Electron beam must hit all pixels frequently to eliminate flicker • Critical fusion frequency • Typically 60 times/sec • Varies with intensity, individuals, phospher persistence, lighting... 9/6/2014
Display Technologies: CRTs • Raster Displays • Interlaced Scanning • Assume can only scan 30 times / second • To reduce flicker, divide frame into two “fields” of odd and even lines 1/30 Sec 1/30 Sec 1/60 Sec 1/60 Sec 1/60 Sec 1/60 Sec Field 1 Field 2 Field 2 Field 1 Frame Frame 9/6/2014
Display Technologies: CRTs • Raster Displays • Scanning (left to right, top to bottom) • Vertical Sync Pulse: Signals the start of the next field • Vertical Retrace: Time needed to get from the bottom of the current field to the top of the next field • Horizontal Sync Pulse: Signals the start of the new scan line • Horizontal Retrace: The time needed to get from the end of the current scan line to the start of the next scan line 9/6/2014
Display Technology: Color CRTs • Color CRTs are much more complicated • Requires manufacturing very precise geometry • Uses a pattern of color phosphors on the screen: • Why red, green, and blue phosphors? Delta electron gun arrangement In-line electron gun arrangement 9/6/2014
Display Technology: Color CRTs • Color CRTs have • Three electron guns • A metal shadow maskto differentiate the beams 9/6/2014
Display Technology: Raster • Raster CRT pros: • Allows solids, not just wireframes • Leverages low-cost CRT technology (i.e., TVs) • Bright! Display emits light • Cons: • Requires screen-size memory array • Discreet sampling (pixels) • Practical limit on size (call it 40 inches) • Bulky • Finicky (convergence, warp, etc) 9/6/2014
Display Technology: LCDs • Liquid Crystal Displays (LCDs) • LCDs: organic molecules, naturally in crystalline state, that liquefy when excited by heat or E field • Crystalline state twists polarized light 90º 9/6/2014
Display Technology: LCDs • Transmissive & reflective LCDs: • LCDs act as light valves, not light emitters, and thus rely on an external light source. • Laptop screen: backlit, transmissive display • Palm Pilot/Game Boy: reflective display 9/6/2014
Display Technology: Plasma • Plasma display panels • Similar in principle to fluorescent light tubes • Small gas-filled capsules are excited by electric field,emits UV light • UV excites phosphor • Phosphor relaxes, emits some other color 9/6/2014
Display Technology • Plasma Display Panel Pros • Large viewing angle • Good for large-format displays • Fairly bright • Cons • Expensive • Large pixels (~1 mm versus ~0.2 mm) • Phosphors gradually deplete • Less bright than CRTs, using more power 9/6/2014
Display Technology: DMDs • Digital Micromirror Devices (projectors) • Microelectromechanical (MEM) devices, fabricated with VLSI techniques 9/6/2014
Display Technology: DMDs • DMDs are truly digital pixels • Vary grey levels by modulating pulse length • Color: multiple chips, or color-wheel • Great resolution • Very bright • Flicker problems 9/6/2014
Display Technologies: Organic LED Arrays • Organic Light-Emitting Diode (OLED) Arrays • The display of the future? Many think so. • OLEDs function like regular semiconductor LEDs • But with thin-film polymer construction: • Thin-film deposition or vacuum deposition process…not grown like a crystal, no high-temperature doping • Thus, easier to create large-area OLED sheet 9/6/2014
Display Technologies: Organic LED Arrays • OLED pros: • Transparent • Flexible • Light-emitting, and quite bright (daylight visible) • Large viewing angle • Fast (< 1 microsecond off-on-off) • Can be made large or small • OLED cons: • Not quite there yet (96x64 displays…) • Not very robust, display lifetime a key issue 9/6/2014
Raster Scan Displays • Beam of electrons deflected onto a phosphor coated screen • Phosphors emit light when excited by the electrons • Phosphor brightness decays -- need to refresh the display • Phosphors make up screen elements called pixels 9/6/2014
Basic Definitions • Raster: A rectangular array of points or dots. • Pixel (Pel): One dot or picture element of the raster • Scan line: A row of pixels Video raster devices display an image by sequentially drawing out the pixels of the scan lines that form the raster. 9/6/2014
Frame Buffers • A frame buffer may be thought of as computer memory organized as a two-dimensional array with each (x,y) addressable location corresponding to one pixel. • Bit Planes or Bit Depth is the number of bits corresponding to each pixel. • A typical frame buffer resolution might be 640 x 480 x 8 1280 x 1024 x 8 1280 x 1024 x 24 9/6/2014
3-Bit Color Display 9/6/2014
Green True Color Display • 24 bitplanes, 8 bits per color gun. • 224 = 16,777,216 8 8 8 Red Blue 9/6/2014
Color Map Look-Up Tables Extends the number of colors that can be displayed by a given number of bit-planes. y RED max GREEN 255 BLUE y Pixel displayed 7 1001 1010 0001 at x', y' 6 67 100110100001 B R G Pixel in bit map 0 at x', y' 0 x x 0 max Frame buffer Look-up table Display 9/6/2014
Pseudo color 28 x 24 Color Map LUT 9/6/2014
Drawing • Most computer generated images made up of geometric primitives (polygons, lines, points) • Application draws them by setting bits in the framebuffer • Most graphics applications involve scene database management Graphic Application Device Driver Scene Database Framebuffer Display 9/6/2014
A DDA Line Drawing Function Line(int x1, int y1, int x2, int y2) { int dx = x1 - x2, dy =y2 -y1; int n = max(abs(dx),abs(dy)); float dt = n, dxdt = dx/dt, dydt = dy/dt; float x = x1, y = y1; while (n--) { DrawPoint( round(x), round(y) ); x +=dxdt; y +=dydt; } } 9/6/2014
We Can Do Better Than That... • Get rid of all those nasty floating point operations • The idea: find the next pixel from the current one • So which of the green pixels is next? 9/6/2014
The Key • We’re only ever going to go right one pixel, or up and right one pixel (if the slope of the line is between 0 and 1). Call these two choices “E” and “NE” • Let’s think of pixels as “lattice points” on a grid • Given an X coordinate, we only need to choose between y and y+1 (y is the Y coordinate of the last pixel) 9/6/2014
The Midpoint Test • Look at the vertical grid line that our line intersects • On which side of the midpoint (y+1/2) does the intersection lie? • If it’s above the midpoint, go NE, otherwise go E 9/6/2014
Our Example 9/6/2014
Implicit Functions • Normally, a line is defined as y= mx +b • Instead, define ,F(x,y) = ax +by + c and let the line be everywhere where F(x,y) = 0 • Now, if F(x,y) > 0 , we’re “above” the line, and if F(x,y) < 0 , we’re “below” the line 9/6/2014
Who Cares? • We can evaluate the implicit line function at the midpoint to figure out where to draw next! • In fact, we can use the last function evaluation to find the next one cheaply! • For ANY x, y: F(x + 1,y) - F(x,y) = a F(x + 1,y + 1) - F(x,y) = a - b 9/6/2014
Line(int x1, int y1, int x2, int y2) { int dx = x2 - x1, dy =y2 -y1; int e = 2*dy - dx; int incrE = 2*dy, incrNE = 2*(dy-dx); int x = x1, y = y1; DrawPoint( x, y ); while (x < x2) { x++; if ( e <= 0 ) { e += incrE; } else { y++; e += incrNE; } DrawPoint( x, y ); } } “e” holds the implicit function evaluation at each x value (actually, it’s multiplied by 2, but all we care about is the sign). Easy extension for lines with arbitrary slopes Midpoint Algorithm 9/6/2014