most early mainframe business computers produced out- put only in the form of punched cards, paper tape, or text printouts. However, system designers realized that some kinds of data were particularly amenable to a graphical rep- resentation. In the early 1950s, the first systems using the cathode ray tube (CRT) for graphics output found special- ized application. For example, the mIT Whirlwind and the Air Force’s SAgE air defense system used a CRT to display information such as the location and heading of radar tar- gets. By 1960, the new relatively inexpensive minicomput- ers such as the DEC PDP series were being connected to CRTs by experimenters, who among other things created Spacewar, the first interactive video game.
By the late 1970s, the microcomputers from Apple, Radio Shack, Commodore, and others either included CRT moni- tors or had adapters that allowed them to be hooked up to regular television sets. These machines generally came with a version of the BASIC language that included com- mands for plotting lines and points and filling enclosed figures with color. While crude by modern standards, these graphics capabilities meant that spreadsheet programs could provide charts while games and simulations could show moving, interacting objects. Desktop computers that showed pictures on television-like screens seemed less for- bidding than giant machines spitting out reams of printed paper (see gRaphicscaRd).
Research at the xerox PARC laboratory in the 1970s demonstrated the advantages of a graphical user interface based on visual objects, including menus, windows, dialog boxes, and icons (see useRinteRface). The Apple macin- tosh, introduced in 1984, was the first commercially via- ble computer in which everything displayed on the screen (including text) consisted of bitmapped graphics. micro- soft’s similar Windows operating environment became dominant on IBm architecture PCs during the 1990s. Today Apple, microsoft, and UNIx-based operating sys- tems include extensive graphics functions. game and mul- timedia developers can call upon such facilities as Apple QuickDraw and microsoft Directx to create high resolu- tion, realistic graphics (see also gameconsole).
b
asicg
raPhicsP
rinciPLesThe most basic capabilities needed for computer graphics are the ability to control the display of pixels (picture elements) on the screen and a way to specify the location of the spots to be displayed. A CRT screen is essentially a grid of pixels that correspond to phosphors (or groups of colored phos- phors) that can be lit up by the electron beam(s). The first IBm PCs, for example, often displayed graphics on a 320 (horizontal) by 200 (vertical) grid, with 4 available colors.
A memory buffer is set up whose bytes correspond to the video display. (A simple monochrome display needs only one bit per pixel, but color displays must use additional space to store the color for each pixel.) A screen image is set up by writing the data bytes to the buffer, which then is sent to the video system. The video system uses the data to control the display device so the corresponding pixels are shown (in the case of a CRT, this means lighting up the “on” pixels with the electron gun[s]).
In most cases screen locations are defined in coordi- nates where point 0,0 is the upper left corner of the screen. The coordinates of the lower right corner depend on the screen resolution, At 320 by 200, the lower right corner would be 319,199.
For example, many versions of BASIC use statements such as the following:
PSET 50,50 ’ draws a dot at X=50, Y=50 LINE (100,50)-(150,100), B ’ draw square
with UL
’ corner at 100,50 and LR ’ corner at 150,100
CIRCLE (100,150), 50, 4 ’ draw a circle of radius 50
’ with center at 200,200 and ’ color 4 (red)
Languages such as C, C++ and Java don’t have built-in graphics commands, but functions can be provided in pro- gram libraries (see libRaRy, pRogRam). They would be used much like the BASIC commands given above.
more commonly, however, programmers use language- independent graphics platforms (see api). With Windows, this usually means Directx, which includes Direct2D for 3D graphics, as well as a variety of multimedia libraries for sound, user interfacing, and networking. A competitor that is particularly popular in the mac and UNIx/Linux worlds is OpengL (Open graphics Library). Both Directx and OpengL run on a wide variety of supported hardware.
g
raPhicsm
odeLsande
nginesmodern applications (such as drawing programs and games) go well beyond simple two-dimensional objects. Indeed, multimedia developers typically use graphics engines designed to work with C++ or Java. A graphics engine provides a way to define and model 2D and 3D polygons. (Curves can be constructed by specifying “control points” for bicubic curves.)
Complex objects can be built up by specifying hierar- chies (for example, a human figure might consist of a head, neck, upper torso, arms, hands, lower torso, legs, feet, and
Some example figures plotted by BASIC graphics statements using screen coordinates.
so on). By creating a hierarchy of arm, hand, fingers a trans- formation (scaling or rotation) of one object can be propa- gated to its dependent objects (see animation). In many cases graphics are created from real-world objects that have been digitally photographed or scanned, and then manipu- lated (see imagepRocessing).
In most scenes the relationships between graphical objects are also important. modern graphics modeling pro- grams use a virtual “camera” to indicate the position and angle from which the graphics are to be viewed. In render- ing the scene, the Painter’s Algorithm can be used to sort objects and draw closer surfaces on top of farther ones, as a painter might paint over the background. Alternatively, the Z-buffer algorithm stores depth information for each pixel to determine which ones are drawn. This technique requires less calculation (because surfaces don’t need to be sorted), but more memory, since the depth of each pixel must be stored.
Within a scene, the effects of light (and its absence, shadows) must be realistically rendered. A simple tech- nique can be used to calculate an overall light level for an object based on its angle in relation to the light source, plus a factor to account for ambient and diffuse light in the environment. The Gouraud shading technique can be used to smooth out the artifacts caused by the simple flat shad- ing method. Another technique, Phong shading, can more realistically reproduce highlights (the sharp image of a light source being reflected within a surface). But the most realis- tic lighting effects are provided through ray tracing, which involves tracing how representative vectors (representing rays of light) reflect from or refract through various sur- faces. However, ray tracing is also the most computationally intensive lighting technique.
Several techniques can be used to give objects more realistic surfaces. Texture mapping can be used to “paint” a realistic texture (perhaps scanned from a real-world object) onto a surface. For example, pieces in a chess game could be given a realistic wood grain or marble texture. This can be further refined through bump mapping, which calculates variations in the texture at each point based on light reflections.
a
PPLicationsandt
radeoFFsThe most graphics-intensive applications today are games, multimedia programs, and scientific visualization or mod- eling applications. Because of the impact graphics have on users’ perception of games and multimedia programs, devel- opers spend a high proportion of their resources on graph- ics. Critics often complain that this is at the expense of core program functions. The software in turn places a high demand on user hardware: The contemporary “multime- dia-ready” PC has a video card that includes special “video accelerator” hardware to speed up the display of graphics data and a video memory buffer of 256 mB or more.
Complex 3D graphics with lighting, shading, and tex- tures may have to be displayed at a relatively low resolution (such as 640 × 480) because of the limitations of the main processor (which performs necessary calculations) and the video card. However as processor speed and memory capac-
ity continue to increase, many computer graphics now rival video and even film in realistic detail.
Further Reading
ACmSIggRAPH. [graphics special interest group] Available online. URL: http://www.siggraph.org/. Accessed June 24, 2007.
Computer Graphics World. [magazine] Available online. URL: http://www.cgw.com/mE2/Default.asp. Accessed June 24, 2007.
govil-Pai, Shalini. Principles of Computer Graphics: Theory and Practice Using OpenGL and Maya. New York: Springer, 2005. Jones, Wendy. Beginning DirectX 10 Game Programming. Boston:
Thomson Course Technology PTR, 2007.