11.07.2015 Views

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

computer graphics 105By the late 1970s, the microcomputers from Apple, RadioShack, Commodore, <strong>and</strong> others either included CRT monitorsor had adapters that allowed them to be hooked upto regular television sets. These machines generally camewith a version <strong>of</strong> the BASIC language that included comm<strong>and</strong>sfor plotting lines <strong>and</strong> points <strong>and</strong> filling enclosedfigures with color. While crude by modern st<strong>and</strong>ards, thesegraphics capabilities meant that spreadsheet programscould provide charts while games <strong>and</strong> simulations couldshow moving, interacting objects. Desktop computers thatshowed pictures on television-like screens seemed less forbiddingthan giant machines spitting out reams <strong>of</strong> printedpaper (see graphics card).Research at the Xerox PARC laboratory in the 1970sdemonstrated the advantages <strong>of</strong> a graphical user interfacebased on visual objects, including menus, windows, dialogboxes, <strong>and</strong> icons (see user interface). The Apple Macintosh,introduced in 1984, was the first commercially viablecomputer in which everything displayed on the screen(including text) consisted <strong>of</strong> bitmapped graphics. Micros<strong>of</strong>t’ssimilar Windows operating environment becamedominant on IBM architecture PCs during the 1990s.Today Apple, Micros<strong>of</strong>t, <strong>and</strong> UNIX-based operating systemsinclude extensive graphics functions. Game <strong>and</strong> multimediadevelopers can call upon such facilities as AppleQuickDraw <strong>and</strong> Micros<strong>of</strong>t DirectX to create high resolution,realistic graphics (see also game console).Basic Graphics PrinciplesThe most basic capabilities needed for computer graphics arethe ability to control the display <strong>of</strong> pixels (picture elements)on the screen <strong>and</strong> a way to specify the location <strong>of</strong> the spotsto be displayed. A CRT screen is essentially a grid <strong>of</strong> pixelsthat correspond to phosphors (or groups <strong>of</strong> colored phosphors)that can be lit up by the electron beam(s). The firstIBM PCs, for example, <strong>of</strong>ten displayed graphics on a 320(horizontal) by 200 (vertical) grid, with 4 available colors.A memory buffer is set up whose bytes correspond to thevideo display. (A simple monochrome display needs onlyone bit per pixel, but color displays must use additionalspace to store the color for each pixel.) A screen image isset up by writing the data bytes to the buffer, which thenis sent to the video system. The video system uses the datato control the display device so the corresponding pixelsare shown (in the case <strong>of</strong> a CRT, this means lighting up the“on” pixels with the electron gun[s]).In most cases screen locations are defined in coordinateswhere point 0,0 is the upper left corner <strong>of</strong> the screen.The coordinates <strong>of</strong> the lower right corner depend on thescreen resolution, At 320 by 200, the lower right cornerwould be 319,199.For example, many versions <strong>of</strong> BASIC use statementssuch as the following:PSET 50,50 ’ draws a dot at X=50, Y=50LINE (100,50)-(150,100), B ’ draw squarewith UL’ corner at 100,50 <strong>and</strong> LR’ corner at 150,100Some example figures plotted by BASIC graphics statements usingscreen coordinates.CIRCLE (100,150), 50, 4 ’ draw a circle <strong>of</strong>radius 50’ with center at 200,200 <strong>and</strong>’ color 4 (red)Languages such as C, C++ <strong>and</strong> Java don’t have built-ingraphics comm<strong>and</strong>s, but functions can be provided in programlibraries (see library, program). They would be usedmuch like the BASIC comm<strong>and</strong>s given above.More commonly, however, programmers use languageindependentgraphics platforms (see api). With Windows,this usually means DirectX, which includes Direct2D for3D graphics, as well as a variety <strong>of</strong> multimedia librariesfor sound, user interfacing, <strong>and</strong> networking. A competitorthat is particularly popular in the Mac <strong>and</strong> UNIX/Linuxworlds is OpenGL (Open Graphics Library). Both DirectX<strong>and</strong> OpenGL run on a wide variety <strong>of</strong> supported hardware.Graphics Models <strong>and</strong> EnginesModern applications (such as drawing programs <strong>and</strong> games)go well beyond simple two-dimensional objects. Indeed,multimedia developers typically use graphics enginesdesigned to work with C++ or Java. A graphics engineprovides a way to define <strong>and</strong> model 2D <strong>and</strong> 3D polygons.(Curves can be constructed by specifying “control points”for bicubic curves.)Complex objects can be built up by specifying hierarchies(for example, a human figure might consist <strong>of</strong> a head,neck, upper torso, arms, h<strong>and</strong>s, lower torso, legs, feet, <strong>and</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!