Abrash Black book of graphics

Embed Size (px)

Citation preview

  • 8/14/2019 Abrash Black book of graphics

    1/9

    Home

    http://../Dr.Dobb%20MAIN%20MENU.pdf
  • 8/14/2019 Abrash Black book of graphics

    2/9

    Whats on the CD ROMThe compani on CD-ROM incl udes al l of t he source codepubl i shed as numbered l i st i ngs i n t he t ext of t he bookpl us compi l ed execut abl es of many of t he demos. I n ad-dit ion youl l fi nd the fol l ow ing extr as on t he CD:

    The classic Zen Timer code profiling tool, in both executable and sourcecode format.

    a@ Exclusive The text of Michaels long out of print 1989 cult classic Zen ofAsS6T373iblyanguage, plus scans of all 1 OOt technical figures.

    ant essays from Michaels ongoing work in game develop-g for the first time in book form.

    :nts descriptions copyrights installation limita-n.

    Hardware Platf orm: A n Int el PC.Not e t hat some code i s processor- specifi c.To run al l code you must have at east aPent i um processor.

    Wi miw s 95 or NT. .

  • 8/14/2019 Abrash Black book of graphics

    3/9

  • 8/14/2019 Abrash Black book of graphics

    4/9

    Black B o o kMichael brashAlbany NY Belmont C Bonn Boston Clnclnnatl Detrolt Johannesburg LondonMadrld Melbourne Mexlco C I ~ewYork Paris Slngapore Tokyo Toronto Washlngton

  • 8/14/2019 Abrash Black book of graphics

    5/9

    PublisherProject EditorProduction Proiect CoordinatorCompositorCover Artist and Cover DesignProofreadersIndexerCD ROM Development

    Keith WeiskampDenise ConstantineK i m offobM a u h a r

    An thon y StockJ e f K e l l u m a n d M e r e d i t h B r i t t a i nCaroline Parksobert Clarfield

    Michael brashsGraphics ProgrammingBlack Book SpecialEdition1 57610 174 6Copyright 1997 by The Coriolis Group, Inc.All rights reserved. This book may not be duplicated in any way without the express writtenconsent of the publisher, except n the form of brief excerpts or quotations for he purposes ofreview. The information contained herein is forhe personal use of the reader and may not beincorporated in any commercial programs, other books, databases, or any kind of softwarewithout written consent of the publisher. Making copies of this book or any portion for anypurpose other than your own is a violation of United States copyright laws.Limits o Liability andDisclaimero WarrantyThe author and publisher of this book have used their best effortsn preparing the book andthe programs contained in it. These efforts include the development, research, and testing ofthe theories and programs to determine their effectiveness. Theuthor and publisher makenowarranty of any kind, expressed or implied, with regardo these programs or the documenta-tion contained in this book.The author and publisher shall notbe liable in the event of incidental or consequential dam-ages in connection with, or arising out of,he furnishing, performance, or se of the programs,associated instructions,and/or claims of productivity gains.TiademarksTrademarked names appear throughout this book. Rather than list the names and entities thatown the trademarks or insert trademark symbol with ach mention of the trademarked name,the publisher states that t is using the names for editorialpurposes only and to the benefit ofthe trademark owner, with no intention of infringing upon that trademark.The Coriolis Group, Inc.n International Thomson Publishing Company14455 N Hayden Road, Suite 220

    Scottsdale, Arizona 85260602/483 0192http://www.coriolis.comFAX 602/483 0193

    Printed in the United States of America1 0 9 8 7 6 5 4 3

  • 8/14/2019 Abrash Black book of graphics

    6/9

    cknowledgmentsBecause this bookwas written over many years, n many different settings, an un-usually large number of people have played a part in making this book possible.First and foremost, thanks (yet again) to Jeff Duntemann for getting this bookstarted, doing thedirty work, and keeping things on track and everyones spiritsup. Thanks to Dan Illowsky for not only contributing ideas and encouragement,but also getting me started writing articles long ago, when I lacked the confidenceto do it on my own-and for teaching me how to handle the business end ofthings. Thanks to Will Fastie for giving me my first crack at writing for a largeaudience in the long-gone but still-missed PC TechJournal, and for showing mehow much fun it could be in his even longer-vanished but genuinely terrific col-umn in Creative C ompu ting (the most enjoyable single column have ever read in acomputer magazine; I used to haunt the mailbox around the beginning of themonth just o see whatWill had to say). Thanks to Robert Keller, Erin OConnor,Liz Oakley, Steve Baker,nd the rest of the cast of housands that made PJa uniquelyfun magazine-especiallyErin, who did more than nyone to each me the properuse of English language. (To this day, Erin will still patiently explain to me whenone should use that andwhen one should use whicheven though eight yearsof instruction on this and related topics have left no discernible imprint on mybrain.) Thanks to on Erickson, Tami Zemel, Monica Berg,nd the est of the DDJcrew for excellent, professional editing, and forjust eing great people. Thanks tothe Coriolis gang or their tireless hard work: JeffDuntemann andKeith Weiskampon the editorial and publishing side, and Brad Grannis, Rob Mauhar, and KimEoffwho handled art,design, and layout. Thanks to Jim ischel who did a terrificjob testing code for the book and putting thecode disk together. Thanks to JackTseng, for teaching me a lot about graphics hardware, and even more about howmuch difference hard work can make. Thanks toohn Cockerham, David Stafford,Terje Mathisen, he BitMan, Chris Hecker, Jim Mackraz, Melvinaftte, JohnNavas,Phil Coleman, Anton Truenfels,ohn Carmack,John Miles,John Bridges, Jim Kent,Hal Hardenberg, Dave Miller, Steve Levy, Jack Davis, uane Strong, Daev Rohr, BillWeber, Dan Gochnauer, Patrick Milligan, Tom Wilson, the people in the ibm.pc/fast.code topic on Bix, and all the rest of you who havebeen so generous with yourideas and suggestions. Ive done my best to acknowledge contributors by name inthis book, but if yourname is omitted, my apologies, and consider yourself thanked;this bookcould not have happened without you.And, of course, thanks to ShayandEmily for their generous patience with my passion f o r writing and computers.And, finally, thanks to the readers of my articles and to you, the reader of thisbook. You are, after all, the ultimate reason why I write, and I hope you learn asmuch and have as much fun reading this book as I did writing itMichael Abrash ([email protected])Bellevue, Washington, 1997

  • 8/14/2019 Abrash Black book of graphics

    7/9

    To Shay

  • 8/14/2019 Abrash Black book of graphics

    8/9

    oreword

    I got my start programming onApple I1 computers at school, andlmost allof my early workwas on theApple platform. After graduating, ituickly be-came obvious hat Iwas going tohave trouble paying my rent working in theApple I1 market in the lateighties, so was forced tomake avery rapid moveinto the IntelPC environment.What I was able to pick up over several years on theApple, I nee ded to learnin the space of a few months on thePC.The biggest benefit to me of actually making money as a programmer wasthe ability to buy all the books and magazines I wanted. I ought a lot. wasin territory that new almost noth ing about,so I read everything that I couldget my hands on. Feature articles, editorials, even advertisementseld infor-mation for me to assimilate.John Romero clued me inarly to thearticles by Michael Abrash. The goodstuff. Graphics hardware. Code optimization.nowledge and wisdom for theaspiring developer. They were evenun to read. For a ong time,my personalquest was to find a copy of Michaels first book, en ofAssembly Language Ilooked inevery bookstore I visited, but I never did find it.made dowith thearticles I could digup.I learned the dark ecrets of the EGA video controller there, and developeda few neat tricks of my own. Some of those tricks became the basis for theCommander Keen series of games, which launched id Software.Ayear orwo later, after Wolfenstein-3D7 Iumped intoMichael (in avirtualsense) for the first time. Ias looking around onM8cT Online, aBBS run bythe Dr. Dobbs publishers before the Internet explosion, when I saw someposts from the man himself. We traded email, and for a couple monthsweplayed tag-team gurus on the graphics forum before Dooms developmenttook over my life.A friend f Michaels at his new job put s back in touchwith each other afterDoom began to make its impact, nd I finally got a chance to meet p withhim in person.

  • 8/14/2019 Abrash Black book of graphics

    9/9

    I talked myself hoarse that day, explaining all the ins and outsof Doom toMichael and an interested groupf his coworkers.Every few days fterwards,I would get an email fromMichael asking for an elaborat ion on oneof mypoints, ordiscussing an aspectof the futureof graphics.Eventually, I popped thequestion-I offered him a ob at d. Just think: oreporting to anyone, an opportunity to code all day, starting with a cleansheet of paper. chance to dohe right thingas a programmer. It didntork.I kept at it though, and about a year later I finally convinced him to comedown and take a look atd. I was working on Quake.Going from Doom to Quakewas a tremendous step. I new where I wantedto end up, butwasnt at all clear what the steps were to get there.was tryinga huge number f approaches , and ven the failureswere teaching me a lot.My enthusiasm must have been contagious, because he took theob.Much heroic programming ensued. everal hundred thousand lines f codewere written. And rewritten. And rewritten. And rewritten.In hindsight, have plenty of regrets aboutvarious aspectsof Quake, but itsa rare person that doesnt freely acknowledge the technical triumphf it. Wenailed it. Sure, a year fromow I will have probably found a ew perspectivethat will make me cringe at the clunkinessf some partof Quake, but at themoment itstill looks pretty damn goodo me.I was very happy to have Michael describe much f the Quake technology inhis ongoing magazine articles.We learned a lot, and hope we managed toteach a bit.When a non-programmer hears aboutichaels articles r the ource codehave released, I usually get a stunned WTFwould you do that for??? look.They dont gett.Programming is not a zero-sum game. Teaching something to a fellow pro-grammer doesnt ake it away from you. Im happy to sharehat I can, becauseIm in it for the ove of programming. The Ferraris are justravy, honestThis book containsmany of the original articles that helped launchy pro-gramming career. hope my contribution to the contentsf the later articlescan provide similar stepping stones for others.

    -John Camnackid Software

    Foreword

    Home Next

    http://../Titles.pdfhttp://gpbbintr.pdf/