ebook img

interactive-computer-graphics-a-top-down-approach-with-webgl-edward-angel-and-dave ... PDF

749 Pages·2014·10.55 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview interactive-computer-graphics-a-top-down-approach-with-webgl-edward-angel-and-dave ...

This page intentionally left blank EditorialDirector,ECS MarciaHorton AcquisitionsEditor MattGoldstein ProgramManager KaylaSmith-Tarbox DirectorofMarketing ChristyLesko MarketingAssistant JonBryant DirectorofProduction ErinGregg SeniorManagingEditor ScottDisanno SeniorProjectManager MarilynLloyd ManufacturingBuyer LindaSager CoverDesigner JoyceCosentinoWells Manager,TextPermissions TimNicholls TextPermissionProjectManager WilliamOpaluch MediaProjectManager RenataButera Full-ServiceProjectManagement CypressGraphics,PaulC.Anagnostopoulos Printer/Binder CourierKendallville CoverPrinter LehighPhoenix-Color TextFont MinionandAvenir CoverImage:OneframeofaparticlephysicssimulationcreatedwithDomeGL,aversionof OpenGLdesignedforgeneratingimagesformultiprojectordomedenvironments.Usedwith permissionfromMatthewDosanjh,JeffBowles,andJoeKniss,ARTSLab,UniversityofNew Mexico. Creditsandacknowledgmentsborrowedfromothersourcesandreproduced,withpermission, appearontheappropriatepageinthetext. Copyright©2015,2012,2009PearsonEducation,Inc.,publishingasAddison-Wesley.Allrights reserved.PrintedintheUnitedStatesofAmerica.ThispublicationisprotectedbyCopyright,and permissionshouldbeobtainedfromthepublisherpriortoanyprohibitedreproduction,storage inaretrievalsystem, ortransmissioninanyformorbyanymeans, electronic, mechanical, photocopying,recording,orlikewise.Toobtainpermission(s)tousematerialfromthiswork, pleasesubmitawrittenrequesttoPearsonEducation,Inc.,PermissionsDepartment,OneLake Street,UpperSaddleRiver,NewJersey07458,oryoumayfaxyourrequestto201-236-3290. Manyofthedesignationsbymanufacturersandsellerstodistinguishtheirproductsareclaimed astrademarks.Wherethosedesignationsappearinthisbook,andthepublisherwasawareofa trademarkclaim,thedesignationshavebeenprintedininitialcapsorallcaps. Theprogramsandapplicationspresentedinthisbookhavebeenincludedfortheirinstructional value.Theyhavebeentestedwithcare,butarenotguaranteedforanyparticularpurpose.The publisherdoesnotofferanywarrantiesorrepresentations,nordoesitacceptanyliabilitieswith respecttotheprogramsorapplications. LibraryofCongressCataloging-in-PublicationData Angel,Edward. Interactivecomputergraphics:atop-downapproachwithWebGL/EdwardAngel, DaveShreiner.—7thedition. pages cm Includesbibliographicalreferencesandindexes. ISBN-13:978-0-13-357484-5(alkalinepaper) ISBN-10:0-13-357484-9(alkalinepaper) 1.Computergraphics. 2.Interactivecomputersystems. 3.WebGL(Computer- programlanguage) 4.OpenGL. I.Shreiner,Dave. II.Title. T385.A51332014 006.6(cid:2)633—dc23 2013050594 10 9 8 7 6 5 4 3 21—V011—18 17 16 15 14 ISBN10:0-13-357484-9 ISBN13:978-0-13-357484-5 To Rose Mary —E.A. To Vicki, Bonnie, Bob, Cookie, and Goatee —D.S. This page intentionally left blank CONTENTS Preface xxi CHAPTER1 GRAPHICSSYSTEMSANDMODELS 1 1.1 ApplicationsofComputerGraphics 2 1.1.1 DisplayofInformation 2 1.1.2 Design 3 1.1.3 SimulationandAnimation 3 1.1.4 UserInterfaces 4 1.2 AGraphicsSystem 5 1.2.1 PixelsandtheFramebuffer 5 1.2.2 TheCPUandtheGPU 6 1.2.3 OutputDevices 7 1.2.4 InputDevices 9 1.3 Images:PhysicalandSynthetic 10 1.3.1 ObjectsandViewers 10 1.3.2 LightandImages 12 1.3.3 ImagingModels 13 1.4 ImagingSystems 15 1.4.1 ThePinholeCamera 15 1.4.2 TheHumanVisualSystem 17 1.5 TheSynthetic-CameraModel 18 1.6 TheProgrammer’sInterface 20 1.6.1 ThePen-PlotterModel 21 1.6.2 Three-DimensionalAPIs 23 1.6.3 ASequenceofImages 26 1.6.4 TheModeling–RenderingParadigm 27 1.7 GraphicsArchitectures 28 1.7.1 DisplayProcessors 29 1.7.2 PipelineArchitectures 29 1.7.3 TheGraphicsPipeline 30 1.7.4 VertexProcessing 31 1.7.5 ClippingandPrimitiveAssembly 31 1.7.6 Rasterization 32 1.7.7 FragmentProcessing 32 vii viii Contents 1.8 ProgrammablePipelines 32 1.9 PerformanceCharacteristics 33 1.10 OpenGLVersionsandWebGL 34 SummaryandNotes 36 SuggestedReadings 36 Exercises 37 CHAPTER2 GRAPHICSPROGRAMMING 39 2.1 TheSierpinskiGasket 39 2.2 ProgrammingTwo-DimensionalApplications 42 2.3 TheWebGLApplicationProgrammingInterface 47 2.3.1 GraphicsFunctions 47 2.3.2 TheGraphicsPipelineandStateMachines 49 2.3.3 OpenGLandWebGL 50 2.3.4 TheWebGLInterface 50 2.3.5 CoordinateSystems 51 2.4 PrimitivesandAttributes 53 2.4.1 PolygonBasics 55 2.4.2 PolygonsinWebGL 56 2.4.3 ApproximatingaSphere 57 2.4.4 Triangulation 58 2.4.5 Text 59 2.4.6 CurvedObjects 60 2.4.7 Attributes 61 2.5 Color 62 2.5.1 RGBColor 64 2.5.2 IndexedColor 66 2.5.3 SettingofColorAttributes 67 2.6 Viewing 68 2.6.1 TheOrthographicView 68 2.6.2 Two-DimensionalViewing 71 2.7 ControlFunctions 71 2.7.1 InteractionwiththeWindowSystem 72 2.7.2 AspectRatioandViewports 73 2.7.3 ApplicationOrganization 74 2.8 TheGasketProgram 75 2.8.1 SendingDatatotheGPU 78 2.8.2 RenderingthePoints 78 2.8.3 TheVertexShader 79 2.8.4 TheFragmentShader 80 Contents ix 2.8.5 CombiningtheParts 80 2.8.6 TheinitShadersFunction 81 2.8.7 TheinitFunction 82 2.8.8 ReadingtheShadersfromtheApplication 83 2.9 PolygonsandRecursion 83 2.10 TheThree-DimensionalGasket 86 2.10.1 UseofThree-DimensionalPoints 86 2.10.2 NamingConventions 88 2.10.3 UseofPolygonsinThreeDimensions 88 2.10.4 Hidden-SurfaceRemoval 91 SummaryandNotes 93 SuggestedReadings 94 Exercises 95 CHAPTER3 INTERACTIONANDANIMATION 99 3.1 Animation 99 3.1.1 TheRotatingSquare 100 3.1.2 TheDisplayProcess 102 3.1.3 DoubleBuffering 103 3.1.4 UsingaTimer 104 3.1.5 UsingrequestAnimFrame 105 3.2 Interaction 106 3.3 InputDevices 107 3.4 PhysicalInputDevices 108 3.4.1 KeyboardCodes 108 3.4.2 TheLightPen 109 3.4.3 TheMouseandtheTrackball 109 3.4.4 DataTablets,TouchPads,andTouchScreens 110 3.4.5 TheJoystick 111 3.4.6 MultidimensionalInputDevices 111 3.4.7 LogicalDevices 112 3.4.8 InputModes 113 3.5 ClientsandServers 115 3.6 ProgrammingEvent-DrivenInput 116 3.6.1 EventsandEventListeners 117 3.6.2 AddingaButton 117 3.6.3 Menus 119 3.6.4 UsingKeycodes 120 3.6.5 Sliders 121 3.7 PositionInput 122

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.