`
`
`
`OpenGL Programming Guide (Addison-Wesley Publishing Company)
`
`Second Edition
`
`The Official Guide to
`Learning OpenGL, Version 1.1
`
`Silicon Graphics, the Silicon Graphics logo, OpenGL and IRIS are registered trademarks, and IRIS
`Graphics Library is a trademark of Silicon Graphics, Inc.
`X Window System is a trademark of Massachusetts Institute of Technology. Display PostScript is a
`registered trademark of Adobe Systems Incorporated.
`
`Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
`trademarks. Where those designations appear in this book, and Addison-Wesley was aware of a
`trademark claim, the designations have been printed in initial capital letters or all capital letters.
`
`46138-2 1. Computer graphics. 2. OpenGL. I. Neider, Jackie. II. Davis, Tom. III. Title.
`T385.N435 1996
`006.6'93(cid:173)dc21 96(cid:173)39420
`CIP
`
`Copyright © 1997 by Silicon Graphics, Inc.
`
`A-W Developers Press is a division of Addison Wesley Longman, Inc.
`
`All rights reserved. No part of this publication may be reproduced, stored in
`a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying,
`recording, or otherwise, without the prior written permission of the publisher. Printed in the United States
`of America. Published simultaneously in Canada.
`
`Sponsoring Editor: Mary Treseler
`
`Project Manager: John Fuller
`
`Production Assistant: Melissa Lima
`
`Cover Design: Jean Seal
`
`Online Book Production: Michael Dixon
`
`1 2 3 4 5 6 7 8 9 -MA- 0099989796
`
`First printing, January 1997
`
`Addison-Wesley books are available for bulk purchases by corporations, institutions, and other
`organizations. For more information please contact the Corporate, Government, and Special Sales
`
`http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaw...GL_PG/@Generic__BookTextView/10;cs=fullhtml;pt=4 (1 of 2) [4/28/2000 9:43:49 PM]
`
`Petitioner Apple Inc. - Exhibit 1014, p. 1
`
`
`
`OpenGL Programming Guide (Addison-Wesley Publishing Company)
`Department at (800) 238-9682.
`
`Find A-W Developers Press on the World Wide Web at:
`http://www.aw.com/devpress/
`
`For my family - Ellyn, Ricky, and Lucy.
`
`To Tom Doeppner and Andy van Dam, who started me along this path.
`
`
`
`OpenGL Programming Guide (Addison-Wesley Publishing Company)
`
`http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaw...GL_PG/@Generic__BookTextView/10;cs=fullhtml;pt=4 (2 of 2) [4/28/2000 9:43:49 PM]
`
`Petitioner Apple Inc. - Exhibit 1014, p. 2
`
`
`
`OpenGL Programming Guide (Addison-Wesley Publishing Company)
`
`
`
`OpenGL Programming Guide (Addison-Wesley Publishing Company)
`
`About This Guide
`
`The OpenGL graphics system is a software interface to graphics hardware. (The GL stands for Graphics
`Library.) It allows you to create interactive programs that produce color images of moving
`three-dimensional objects. With OpenGL, you can control computer-graphics technology to produce
`realistic pictures or ones that depart from reality in imaginative ways. This guide explains how to
`program with the OpenGL graphics system to deliver the visual effect you want.
`
`What This Guide Contains
`
`This guide has 14 chapters, one more than the ideal number. The first five chapters present basic
`information that you need to understand to be able to draw a properly colored and lit three-dimensional
`object on the screen.
`Chapter 1, "Introduction to OpenGL," provides a glimpse into the kinds of things OpenGL can
`l
`do. It also presents a simple OpenGL program and explains essential programming details you
`need to know for subsequent chapters.
`
`Chapter 2, "State Management and Drawing Geometric Objects," explains how to create a
`l
`three-dimensional geometric description of an object that is eventually drawn on the screen.
`
`Chapter 3, "Viewing," describes how such three-dimensional models are transformed before
`l
`being drawn onto a two-dimensional screen. You can control these transformations to show a
`particular view of a model.
`
`Chapter 4, "Color," describes how to specify the color and shading method used to draw an
`l
`object.
`
`Chapter 5, "Lighting," explains how to control the lighting conditions surrounding an object and
`l
`how that object responds to light (that is, how it reflects or absorbs light). Lighting is an important
`topic, since objects usually don't look three-dimensional until they're lit.
`
`The remaining chapters explain how to optimize or add sophisticated features to your three-dimensional
`scene. You might choose not to take advantage of many of these features until you're more comfortable
`with OpenGL. Particularly advanced topics are noted in the text where they occur.
`Chapter 6, "Blending, Antialiasing, Fog, and Polygon Offset," describes techniques essential to
`l
`creating a realistic scene - alpha blending (to create transparent objects), antialiasing (to eliminate
`jagged edges), atmospheric effects (to simulate fog or smog), and polygon offset (to remove visual
`artifacts when highlighting the edges of filled polygons).
`
`http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaw...L_PG/@Generic__BookTextView/73;cs=fullhtml;pt=69 (1 of 7) [4/28/2000 9:43:56 PM]
`
`Petitioner Apple Inc. - Exhibit 1014, p. 3
`
`
`
`OpenGL Programming Guide (Addison-Wesley Publishing Company)
`
`Chapter 7, "Display Lists," discusses how to store a series of OpenGL commands for execution at
`l
`a later time. You'll want to use this feature to increase the performance of your OpenGL program.
`
`Chapter 8, "Drawing Pixels, Bitmaps, Fonts, and Images," discusses how to work with sets of
`l
`two-dimensional data as bitmaps or images. One typical use for bitmaps is describing characters in
`fonts.
`
`Chapter 9, "Texture Mapping," explains how to map one- and two-dimensional images called
`l
`textures onto three-dimensional objects. Many marvelous effects can be achieved through texture
`mapping.
`
`Chapter 10, "The Framebuffer," describes all the possible buffers that can exist in an OpenGL
`l
`implementation and how you can control them. You can use the buffers for such effects as
`hidden-surface elimination, stenciling, masking, motion blur, and depth-of-field focusing.
`
`Chapter 11, "Tessellators and Quadrics," shows how to use the tessellation and quadrics
`l
`routines in the GLU (OpenGL Utility Library).
`
`Chapter 12, "Evaluators and NURBS," gives an introduction to advanced techniques for
`l
`efficiently generating curves or surfaces.
`
`Chapter 13, "Selection and Feedback," explains how you can use OpenGL's selection
`l
`mechanism to select an object on the screen. It also explains the feedback mechanism, which
`allows you to collect the drawing information OpenGL produces rather than having it be used to
`draw on the screen.
`
`Chapter 14, "Now That You Know," describes how to use OpenGL in several clever and
`l
`unexpected ways to produce interesting results. These techniques are drawn from years of
`experience with both OpenGL and the technological precursor to OpenGL, the Silicon Graphics
`IRIS Graphics Library.
`
`In addition, there are several appendices that you will likely find useful.
`Appendix A, "Order of Operations,", gives a technical overview of the operations OpenGL
`l
`performs, briefly describing them in the order in which they occur as an application executes.
`
`Appendix B, "State Variables," lists the state variables that OpenGL maintains and describes
`l
`how to obtain their values.
`
`Appendix C, "OpenGL and Window Systems," briefly describes the routines available in
`l
`window-system specific libraries, which are extended to support OpenGL rendering. WIndow
`system interfaces to the X Window System, Apple MacIntosh, IBM OS/2, and Microsoft Windows
`
`http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaw...L_PG/@Generic__BookTextView/73;cs=fullhtml;pt=69 (2 of 7) [4/28/2000 9:43:56 PM]
`
`Petitioner Apple Inc. - Exhibit 1014, p. 4
`
`
`
`OpenGL Programming Guide (Addison-Wesley Publishing Company)
`NT and Windows 95 are discussed here.
`
`Appendix D, "Basics of GLUT: The OpenGL Utility Toolkit," discusses the library that handles
`l
`window system operations. GLUT is portable and it makes code examples shorter and more
`comprehensible.
`
`Appendix E, "Calculating Normal Vectors," tells you how to calculate normal vectors for
`l
`different types of geometric objects.
`
`Appendix F, "Homogeneous Coordinates and Transformation Matrices," explains some of the
`l
`mathematics behind matrix transformations.
`
`Appendix G, "Programming Tips," lists some programming tips based on the intentions of the
`l
`designers of OpenGL that you might find useful.
`
`Appendix H, "OpenGL Invariance," describes when and where an OpenGL implementation
`l
`must generate the exact pixel values described in the OpenGL specification.
`
`Appendix I, "Color Plates," contains the color plates that appear in the printed version of this
`l
`guide.
`
`Finally, an extensive Glossary defines the key terms used in this guide.
`
`What's New in This Edition
`
`To the question, "What's new in this edition?" the wiseacre answer is "About 100 pages." The more
`informative answer follows.
`Detailed information about the following new features of OpenGL Version 1.1 has been added.
`l
`
`Vertex arrays
`m
`
`Texturing enhancements, including texture objects (including residency and prioritization),
`m
`internal texture image format, texture subimages, texture proxies, and copying textures from
`frame buffer data
`
`Polygon offset
`m
`
`Logical operation in RGBA mode
`m
`
`Program examples have been converted to Mark Kilgard's GLUT, which stands for Graphics
`l
`
`http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaw...L_PG/@Generic__BookTextView/73;cs=fullhtml;pt=69 (3 of 7) [4/28/2000 9:43:56 PM]
`
`Petitioner Apple Inc. - Exhibit 1014, p. 5
`
`
`
`OpenGL Programming Guide (Addison-Wesley Publishing Company)
`Library Utility Toolkit. GLUT is an increasingly popular windowing toolkit, which is
`well-documented and has been ported to different window systems.
`
`More detail about some topics that were in the first edition, especially coverage of the OpenGL
`l
`Utility (GLU) Library.
`
`An entire chapter on GLU tessellators and quadrics
`m
`
`A section (in Chapter 3) on the use of gluProject() and gluUnProject(), which mimics or
`m
`reverses the operations of
`the geometric processing pipeline (This has been the subject of frequent discussions on the
`Internet newsgroup on OpenGL, comp.graphics.api.opengl.)
`
`Expanded coverage (and more diagrams) about images
`m
`
`Changes to GLU NURBS properties
`m
`
`Error handling and vendor-specific extensions to OpenGL
`m
`
`Appendix C expanded to include OpenGL interfaces to several window/operating systems
`m
`
`The first edition's appendix on the OpenGL Utility Library was removed, and its information has
`been integrated into other chapters.
`
`A much larger and more informative index
`l
`
`Bug fixes and minor topic reordering. Moving the display list chapter is the most noticeable
`l
`change.
`
`What You Should Know Before Reading This Guide
`
`This guide assumes only that you know how to program in the C language and that you have some
`background in mathematics (geometry, trigonometry, linear algebra, calculus, and differential geometry).
`Even if you have little or no experience with computer-graphics technology, you should be able to follow
`most of the discussions in this book. Of course, computer graphics is a huge subject, so you may want to
`enrich your learning experience with supplemental reading.
`Computer Graphics: Principles and Practice by James D. Foley, Andries van Dam, Steven K.
`l
`Feiner, and John F. Hughes (Reading, MA: Addison-Wesley, 1990) - This book is an encyclopedic
`treatment of the subject of computer graphics. It includes a wealth of information but is probably
`best read after you have some experience with the subject.
`
`http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaw...L_PG/@Generic__BookTextView/73;cs=fullhtml;pt=69 (4 of 7) [4/28/2000 9:43:56 PM]
`
`Petitioner Apple Inc. - Exhibit 1014, p. 6
`
`
`
`OpenGL Programming Guide (Addison-Wesley Publishing Company)
`3D Computer Graphics: A User's Guide for Artists and Designers by Andrew S. Glassner (New
`l
`York: Design Press, 1989) - This book is a nontechnical, gentle introduction to computer graphics.
`It focuses on the visual effects that can be achieved rather than on the techniques needed to
`achieve them.
`
`Once you begin programming with OpenGL, you might want to obtain the OpenGL Reference Manual
`by the OpenGL Architecture Review Board (Reading, MA: Addison-Wesley Developers Press, 1996),
`which is designed as a companion volume to this guide. The Reference Manual provides a technical view
`of how OpenGL operates on data that describes a geometric object or an image to produce an image on
`the screen. It also contains full descriptions of each set of related OpenGL commands - the parameters
`used by the commands, the default values for those parameters, and what the commands accomplish.
`Many OpenGL implementations have this same material on-line, in the form of man pages or other help
`documents, and it's probably more up-to-date. There is also a http version on the World Wide Web;
`consult Silicon Graphics OpenGL Web Site (http://www.sgi.com/Technology/openGL) for the latest
`pointer.
`
`OpenGL is really a hardware-independent specification of a programming interface, and you use a
`particular implementation of it on a particular kind of hardware. This guide explains how to program
`with any OpenGL implementation. However, since implementations may vary slightly - in performance
`and in providing additional, optional features, for example - you might want to investigate whether
`supplementary documentation is available for the particular implementation you're using. In addition,
`you might have OpenGL-related utilities, toolkits, programming and debugging support, widgets, sample
`programs, and demos available to you with your system.
`
`How to Obtain the Sample Code
`
`This guide contains many sample programs to illustrate the use of particular OpenGL programming
`techniques. These programs make use of Mark Kilgard's OpenGL Utility Toolkit (GLUT). GLUT is
`documented in OpenGL Programming for the X Window System by Mark Kilgard (Reading, MA:
`Addison-Wesley Developers Press, 1996). The section "OpenGL-Related Libraries" in Chapter 1 and
`Appendix D gives more information about using GLUT. If you have access to the Internet, you can
`obtain the source code for both the sample programs and GLUT for free via anonymous ftp (file-transfer
`protocol).
`
`For the source code examples found in this book, grab this file:
`ftp://sgigate.sgi.com/pub/opengl/opengl1_1.tar.Z
`
`The files you receive are compressed tar archives. To uncompress and extract the files, type
`uncompress opengl1_1.tar
`tar xf opengl1_1.tar
`
`For Mark Kilgard's source code for an X Window System version of GLUT, you need to know what the
`most current version is. The filename will be glut-i.j.tar.Z, where i is the major revision number and j is
`the minor revision number of the most recent version. Check the directory for the right numbers, then
`grab this file:
`
`http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaw...L_PG/@Generic__BookTextView/73;cs=fullhtml;pt=69 (5 of 7) [4/28/2000 9:43:56 PM]
`
`Petitioner Apple Inc. - Exhibit 1014, p. 7
`
`
`
`OpenGL Programming Guide (Addison-Wesley Publishing Company)
`ftp://sgigate.sgi.com/pub/opengl/xjournal/GLUT/glut-i.j.tar.Z
`
`This file must also be uncompressed and extracted by using the tar command. The sample programs and
`GLUT library are created as subdirectories from wherever you are in the file directory structure.
`
`Other ports of GLUT (for example, for Microsoft Windows NT) are springing up. A good place to start
`searching for the latest developments in GLUT and for OpenGL, in general, is Silicon Graphics' OpenGL
`Web Site:
`http://www.sgi.com/Technology/openGL
`
`Many implementations of OpenGL might also include the code samples as part of the system. This
`source code is probably the best source for your implementation, because it might have been optimized
`for your system. Read your machine-specific OpenGL documentation to see where the code samples can
`be found.
`
`Errata
`
`Although this book is ideal and perfec in every conceivable way, there is a a pointer to an errata list from
`the Silicon Graphics OpenGL Web Site:
`
`http://www.sgi.com/Technology/openGL
`
`The authors are quite certain there will be a little note there to reassure the reader of the pristeen quality
`of this book.
`
`Style Conventions
`
`These style conventions are used in this guide:
`Bold - Command and routine names and matrices
`l
`
`Italics - Variables, arguments, parameter names, spatial dimensions, matrix components, and the
`l
`first occurrence of key terms
`
`Regular - Enumerated types and defined constants
`l
`
`Code examples are set off from the text in a monospace font, and command summaries are shaded with
`gray boxes.
`
`In a command summary, braces are used to identify choices among data types. In the following example,
`glCommand has four possible suffixes: s, i, f, and d, which stand for the data types GLshort, GLint,
`GLfloat, and GLdouble. In the function prototype for glCommand, TYPE is a wildcard that represents
`the data type indicated by the suffix.
`void glCommand{sifd}(TYPEx1, TYPEy1, TYPEx2, TYPEy2);
`
`http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaw...L_PG/@Generic__BookTextView/73;cs=fullhtml;pt=69 (6 of 7) [4/28/2000 9:43:56 PM]
`
`Petitioner Apple Inc. - Exhibit 1014, p. 8
`
`
`
`OpenGL Programming Guide (Addison-Wesley Publishing Company)
`
`
`
`OpenGL Programming Guide (Addison-Wesley Publishing Company)
`
`http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaw...L_PG/@Generic__BookTextView/73;cs=fullhtml;pt=69 (7 of 7) [4/28/2000 9:43:56 PM]
`
`Petitioner Apple Inc. - Exhibit 1014, p. 9
`
`
`
`OpenGL Programming Guide (Addison-Wesley Publishing Company)
`
`
`
`OpenGL Programming Guide (Addison-Wesley Publishing Company)
`
`Acknowledgments
`
`The second edition of this book required the support of many individuals. The impetus for the second
`edition began with Paula Womack and Tom McReynolds of Silicon Graphics, who recognized the need
`for a revision and also contributed some of the new material. John Schimpf, OpenGL Product Manager at
`Silicon Graphics, was instrumental in getting the revision off and running.
`
`Thanks to many people at Silicon Graphics: Allen Akin, Brian Cabral, Norman Chin, Kathleen
`Danielson, Craig Dunwoody, Michael Gold, Paul Ho, Deanna Hohn, Brian Hook, Kevin Hunter, David
`Koller, Zicheng Liu, Rob Mace, Mark Segal, Pierre Tardif, and David Yu for putting up with intrusions
`and inane questions. Thanks to Dave Orton and Kurt Akeley for executive-level support. Thanks to Kay
`Maitz and Renate Kempf for document production support. And thanks to Cindy Ahuna, for always
`keeping an eye out for free food.
`
`Special thanks are due to the reviewers who volunteered and trudged through the six hundred pages of
`technical material that constitute the second edition: Bill Armstrong of Evans & Sutherland, Patrick
`Brown of IBM, Jim Cobb of Parametric Technology, Mark Kilgard of Silicon Graphics, Dale Kirkland of
`Intergraph, and Andy Vesper of Digital Equipment. Their careful diligence has greatly improved the
`quality of this book.
`
`Thanks to Mike Heck of Template Graphics Software, Gilman Wong of Microsoft, and Suzy Deffeyes of
`IBM for their contributions to the technical information in Appendix C.
`
`The continued success of the OpenGL owes much to the commitment of the OpenGL Architecture
`Review Board (ARB) participants. They guide the evolution of the OpenGL standard and update the
`specification to reflect the needs and desires of the graphics industry. Active contributors of the OpenGL
`ARB include Fred Fisher of AccelGraphics; Bill Clifford, Dick Coulter, and Andy Vesper of Digital
`Equipment Corporation; Bill Armstrong of Evans & Sutherland; Kevin LeFebvre and Randi Rost of
`Hewlett-Packard; Pat Brown and Bimal Poddar of IBM; Igor Sinyak of Intel; Dale Kirkland of
`Intergraph; Henri Warren of Megatek; Otto Berkes, Drew Bliss, Hock San Lee, and Steve Wright of
`Microsoft; Ken Garnett of NCD; Jim Cobb of Parametric Technology; Craig Dunwoody, Chris Frazier,
`and Paula Womack of Silicon Graphics; Tim Misner and Bill Sweeney of Sun Microsystems; Mike Heck
`of Template Graphics Software; and Andy Bigos, Phil Huxley, and Jeremy Morris of 3Dlabs.
`
`The second edition of this book would not have been possible without the first edition, and neither
`edition would have been possible without the creation of OpenGL.
`
`Thanks to the chief architects of OpenGL: Mark Segal and Kurt Akeley. Special recognition goes to the
`pioneers who heavily contributed to the initial design and functionality of OpenGL: Allen Akin, David
`Blythe, Jim Bushnell, Dick Coulter, John Dennis, Raymond Drewry, Fred Fisher, Chris Frazier, Momi
`Furuya, Bill Glazier, Kipp Hickman, Paul Ho, Rick Hodgson, Simon Hui, Lesley Kalmin, Phil Karlton,
`On Lee, Randi Rost, Kevin P. Smith, Murali Sundaresan, Pierre Tardif, Linas Vepstas, Chuck Whitmer,
`Jim Winget, and Wei Yen.
`
`http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaw..._PG/@Generic__BookTextView/532;cs=fullhtml;pt=73 (1 of 3) [4/28/2000 9:43:59 PM]
`
`Petitioner Apple Inc. - Exhibit 1014, p. 10
`
`
`
`OpenGL Programming Guide (Addison-Wesley Publishing Company)
`
`Assembling the set of colorplates was no mean feat. The sequence of plates based on the cover image
`(Plate 1 through Plate 9) was created by Thad Beier, Seth Katz, and Mason Woo. Plate 10 through Plate
`12 are snapshots of programs created by Mason. Gavin Bell, Kevin Goldsmith, Linda Roy, and Mark
`Daly created the fly-through program used for Plate 24. The model for Plate 25 was created by Barry
`Brouillette of Silicon Graphics; Doug Voorhies, also of Silicon Graphics, performed some image
`processing for the final image. Plate 26 was created by John Rohlf and Michael Jones, both of Silicon
`Graphics. Plate 27 was created by Carl Korobkin of Silicon Graphics. Plate 28 is a snapshot from a
`program written by Gavin Bell with contributions from the Open Inventor team at Silicon Graphics -
`Alain Dumesny, Dave Immel, David Mott, Howard Look, Paul Isaacs, Paul Strauss, and Rikk Carey.
`Plate 29 and 30 are snapshots from a visual simulation program created by the Silicon Graphics IRIS
`Performer team - Craig Phillips, John Rohlf, Sharon Clay, Jim Helman, and Michael Jones - from a
`database produced for Silicon Graphics by Paradigm Simulation, Inc. Plate 31 is a snapshot from skyfly,
`the precursor to Performer, which was created by John Rohlf, Sharon Clay, and Ben Garlick, all of
`Silicon Graphics.
`
`Several other people played special roles in creating this book. If we were to list other names as authors
`on the front of this book, Kurt Akeley and Mark Segal would be there, as honorary yeoman. They helped
`define the structure and goals of the book, provided key sections of material for it, reviewed it when
`everybody else was too tired of it to do so, and supplied that all-important humor and support throughout
`the process. Kay Maitz provided invaluable production and design assistance. Kathy Gochenour very
`generously created many of the illustrations for this book. Susan Riley copyedited the manuscript, which
`is a brave task, indeed.
`
`And now, each of the authors would like to take the 15 minutes that have been allotted to them by Andy
`Warhol to say thank you.
`
`I'd like to thank my managers at Silicon Graphics - Dave Larson and Way Ting - and the members of my
`group - Patricia Creek, Arthur Evans, Beth Fryer, Jed Hartman, Ken Jones, Robert Reimann, Eve
`Stratton (aka Margaret-Anne Halse), John Stearns, and Josie Wernecke - for their support during this
`lengthy process. Last but surely not least, I want to thank those whose contributions toward this project
`are too deep and mysterious to elucidate: Yvonne Leach, Kathleen Lancaster, Caroline Rose, Cindy
`Kleinfeld, and my parents, Florence and Ferdinand Neider.
`
`- JLN
`
`In addition to my parents, Edward and Irene Davis, I'd like to thank the people who taught me most of
`what I know about computers and computer graphics - Doug Engelbart and Jim Clark.
`
`- TRD
`
`I'd like to thank the many past and current members of Silicon Graphics whose accommodation and
`enlightenment were essential to my contribution to this book: Gerald Anderson, Wendy Chin, Bert
`Fornaciari, Bill Glazier, Jill Huchital, Howard Look, Bill Mannel, David Marsland, Dave Orton, Linda
`Roy, Keith Seto, and Dave Shreiner. Very special thanks to Karrin Nicol, Leilani Gayles, Kevin
`Dankwardt, Kiyoshi Hasegawa, and Raj Singh for their guidance throughout my career. I also bestow
`much gratitude to my teammates on the Stanford B ice hockey team for periods of glorious distraction
`throughout the initial writing of this book. Finally, I'd like to thank my family, especially my mother, Bo,
`
`http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaw..._PG/@Generic__BookTextView/532;cs=fullhtml;pt=73 (2 of 3) [4/28/2000 9:43:59 PM]
`
`Petitioner Apple Inc. - Exhibit 1014, p. 11
`
`
`
`OpenGL Programming Guide (Addison-Wesley Publishing Company)
`and my late father, Henry.
`
`- MW
`
`
`
`OpenGL Programming Guide (Addison-Wesley Publishing Company)
`
`http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaw..._PG/@Generic__BookTextView/532;cs=fullhtml;pt=73 (3 of 3) [4/28/2000 9:43:59 PM]
`
`Petitioner Apple Inc. - Exhibit 1014, p. 12
`
`
`
`OpenGL Programming Guide (Addison-Wesley Publishing Company)
`
`
`
`OpenGL Programming Guide (Addison-Wesley Publishing Company)
`
`Chapter 1
`Introduction to OpenGL
`
`Chapter Objectives
`
`After reading this chapter, you'll be able to do the following:
`Appreciate in general terms what OpenGL does
`l
`
`Identify different levels of rendering complexity
`l
`
`Understand the basic structure of an OpenGL program
`l
`
`Recognize OpenGL command syntax
`l
`
`Identify the sequence of operations of the OpenGL rendering pipeline
`l
`
`Understand in general terms how to animate graphics in an OpenGL program
`l
`
`This chapter introduces OpenGL. It has the following major sections:
`"What Is OpenGL?" explains what OpenGL is, what it does and doesn't do, and how it works.
`l
`
`"A Smidgen of OpenGL Code" presents a small OpenGL program and briefly discusses it. This section also defines a few
`l
`basic computer-graphics terms.
`
`"OpenGL Command Syntax" explains some of the conventions and notations used by OpenGL commands.
`l
`
`"OpenGL as a State Machine" describes the use of state variables in OpenGL and the commands for querying, enabling,
`l
`and disabling states.
`
`"OpenGL Rendering Pipeline" shows a typical sequence of operations for processing geometric and image data.
`l
`
`"OpenGL-Related Libraries" describes sets of OpenGL-related routines, including an auxiliary library specifically written
`l
`for this book to simplify programming examples.
`
`"Animation" explains in general terms how to create pictures on the screen that move.
`l
`
`What Is OpenGL?
`
`OpenGL is a software interface to graphics hardware. This interface consists of about 150 distinct commands that you use to
`specify the objects and operations needed to produce interactive three-dimensional applications.
`
`OpenGL is designed as a streamlined, hardware-independent interface to be implemented on many different hardware platforms.
`To achieve these qualities, no commands for performing windowing tasks or obtaining user input are included in OpenGL;
`instead, you must work through whatever windowing system controls the particular hardware you're using. Similarly, OpenGL
`doesn't provide high-level commands for describing models of three-dimensional objects. Such commands might allow you to
`specify relatively complicated shapes such as automobiles, parts of the body, airplanes, or molecules. With OpenGL, you must
`
`http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaw...PG/@Generic__BookTextView/622;cs=fullhtml;pt=532 (1 of 16) [4/28/2000 9:44:15 PM]
`
`Petitioner Apple Inc. - Exhibit 1014, p. 13
`
`
`
`OpenGL Programming Guide (Addison-Wesley Publishing Company)
`build up your desired model from a small set of geometric primitives - points, lines, and polygons.
`
`A sophisticated library that provides these features could certainly be built on top of OpenGL. The OpenGL Utility Library
`(GLU) provides many of the modeling features, such as quadric surfaces and NURBS curves and surfaces. GLU is a standard
`part of every OpenGL implementation. Also, there is a higher-level, object-oriented toolkit, Open Inventor, which is built atop
`OpenGL, and is available separately for many implementations of OpenGL. (See "OpenGL-Related Libraries" for more
`information about Open Inventor.)
`
`Now that you know what OpenGL doesn't do, here's what it does do. Take a look at the color plates - they illustrate typical uses
`of OpenGL. They show the scene on the cover of this book, rendered (which is to say, drawn) by a computer using OpenGL in
`successively more complicated ways. The following list describes in general terms how these pictures were made.
`"Plate 1" shows the entire scene displayed as a wireframe model - that is, as if all the objects in the scene were made of
`l
`wire. Each line of wire corresponds to an edge of a primitive (typically a polygon). For example, the surface of the table is
`constructed from triangular polygons that are positioned like slices of pie.
`
`Note that you can see portions of objects that would be obscured if the objects were solid rather than wireframe. For
`example, you can see the entire model of the hills outside the window even though most of this model is normally hidden
`by the wall of the room. The globe appears to be nearly solid because it's composed of hundreds of colored blocks, and you
`see the wireframe lines for all the edges of all the blocks, even those forming the back side of the globe. The way the globe
`is constructed gives you an idea of how complex objects can be created by assembling lower-level objects.
`
`"Plate 2" shows a depth-cued version of the same wireframe scene. Note that the lines farther from the eye are dimmer,
`l
`just as they would be in real life, thereby giving a visual cue of depth. OpenGL uses atmospheric effects (collectively
`referred to as fog) to achieve depth cueing.
`
`"Plate 3" shows an antialiased version of the wireframe scene. Antialiasing is a technique for reducing the jagged edges
`l
`(also known as jaggies) created when approximating smooth edges using pixels - short for picture elements - which are
`confined to a rectangular grid. Such jaggies are usually the most visible with near-horizontal or near-vertical lines.
`
`"Plate 4" shows a flat-shaded, unlit version of the scene. The objects in the scene are now shown as solid. They appear
`l
`"flat" in the sense that only one color is used to render each polygon, so they don't appear smoothly rounded. There are no
`effects from any light sources.
`
`"Plate 5" shows a lit, smooth-shaded version of the scene. Note how the scene looks much more realistic and
`l
`three-dimensional when the objects are shaded to respond to the light sources in the room as if the objects were smoothly
`rounded.
`
`"Plate 6" adds shadows and textures to the previous version of the scene. Shadows aren't an explicitly defined feature of
`l
`OpenGL (there is no "shadow command"), but you can create them yourself using the techniques described in Chapter 14.
`Texture mapping allows you to apply a two-dimensional image onto a three-dimensional object. In this scene, the top on
`the table surface is the most vibrant example of texture mapping. The wood grain on the floor and table surface are all
`texture mapped, as well as the wallpaper and the toy top (on the table).
`
`"Plate 7" shows a motion-blurred object in the scene. The sphinx (or dog, depending on your Rorschach tendencies)
`l
`appears to be captured moving forward, leaving a blurred trace of its path of motion.
`
`"Plate 8" shows the scene as it's drawn for the cover of the book from a different viewpoint. This plate illustrates that the
`l
`image really is a snapshot of models of three-dimensional objects.
`
`"Plate 9" brings back the use of fog, which was seen in "Plate 2," to show the presence of smoke particles in the air. Note
`l
`how the same effect in "Plate 2" now has a more dramatic impact in "Plate 9."
`
`"Plate 10" shows the depth-of-field effect, which simulates the inability of a camera lens to maintain all objects in a
`l
`
`http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaw...PG/@Generic__BookTextView/622;cs=fullhtml;pt=532 (2 of 16) [4/28/2000 9:44:15 PM]
`
`Petitioner Apple Inc. - Exhibit 1014, p. 14
`
`
`
`OpenGL Programming Guide (Addison-Wesley Publishing Company)
`photographed scene in focus. The camera focuses on a particular spot in the scene. Objects that are significantly closer