0% found this document useful (0 votes)
25 views100 pages

Computer Graphics Through openGL Third Edition Guha Kindle & PDF Formats

Academic material: Computer graphics through openGL Third Edition GuhaAvailable for instant access. A structured learning tool offering deep insights, comprehensive explanations, and high-level academic value.

Uploaded by

rossymija0356
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views100 pages

Computer Graphics Through openGL Third Edition Guha Kindle & PDF Formats

Academic material: Computer graphics through openGL Third Edition GuhaAvailable for instant access. A structured learning tool offering deep insights, comprehensive explanations, and high-level academic value.

Uploaded by

rossymija0356
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 100

Computer graphics through openGL Third Edition Guha

2025 instant download

Now available at textbookfull.com


https://textbookfull.com/product/computer-graphics-through-opengl-
third-edition-guha/

★★★★★
4.7 out of 5.0 (78 reviews )

Instant PDF Access


Computer graphics through openGL Third Edition Guha

TEXTBOOK

Available Formats

■ PDF eBook Study Guide Ebook

EXCLUSIVE 2025 ACADEMIC EDITION – LIMITED RELEASE

Available Instantly Access Library


More products digital (pdf, epub, mobi) instant
download maybe you interests ...

Computer Graphics Through OpenGL: From Theory to


Experiments Sumanta Guha

https://textbookfull.com/product/computer-graphics-through-
opengl-from-theory-to-experiments-sumanta-guha/

Computer Graphics Programming in OpenGL Using C++,


Third Edition Gordon Phd

https://textbookfull.com/product/computer-graphics-programming-
in-opengl-using-c-third-edition-gordon-phd/

Computer Graphics Programming in OpenGL with Java


Gordon

https://textbookfull.com/product/computer-graphics-programming-
in-opengl-with-java-gordon/

Introduction to Computer Graphics with OpenGL ES First


Edition Junghyun Han

https://textbookfull.com/product/introduction-to-computer-
graphics-with-opengl-es-first-edition-junghyun-han/
Computer Graphics Programming in OpenGL with Java 2nd
Edition V. Scott Gordon

https://textbookfull.com/product/computer-graphics-programming-
in-opengl-with-java-2nd-edition-v-scott-gordon/

Learn OpenGL Learn modern OpenGL graphics programming


in a step by step fashion 1st Edition Joey De Vries

https://textbookfull.com/product/learn-opengl-learn-modern-
opengl-graphics-programming-in-a-step-by-step-fashion-1st-
edition-joey-de-vries/

R Graphics (Third Edition) Paul Murrell

https://textbookfull.com/product/r-graphics-third-edition-paul-
murrell/

Fundamentals of Computer Graphics Steve Marschner

https://textbookfull.com/product/fundamentals-of-computer-
graphics-steve-marschner/

Mathematics for Computer Graphics John Vince

https://textbookfull.com/product/mathematics-for-computer-
graphics-john-vince/
Computer Graphics Through OpenGL
From Theory to Experiments
Third Edition
Computer Graphics Through OpenGL
From Theory to Experiments
Third Edition

Sumanta Guha
Asian Institute of Technology, Thailand
Cover Designed by Sumanta Guha

CRC Press
Taylor & Francis Group
6000 Broken Sound Parkway NW, Suite 300
Boca Raton, FL 33487-2742

© 2019 by Taylor & Francis Group, LLC


CRC Press is an imprint of Taylor & Francis Group, an Informa business

No claim to original U.S. Government works

Printed on acid-free paper


Version Date: 20181022

International Standard Book Number-13: 978-1-138-61264-8 (Hardback)

This book contains information obtained from authentic and highly regarded sources. Reasonable efforts have been made to publish reliable data and
information, but the author and publisher cannot assume responsibility for the validity of all materials or the consequences of their use. The authors and
publishers have attempted to trace the copyright holders of all material reproduced in this publication and apologize to copyright holders if permission
to publish in this form has not been obtained. If any copyright material has not been acknowledged please write and let us know so we may rectify in any
future reprint.

Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or utilized in any form by any electronic,
mechanical, or other means, now known or hereafter invented, including photocopying, microfilming, and recording, or in any information storage or
retrieval system, without written permission from the publishers.

For permission to photocopy or use material electronically from this work, please access www.copyright.com (http://www.copyright.com/) or contact
the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. CCC is a not-for-profit organization that provides
licenses and registration for a variety of users. For organizations that have been granted a photocopy license by the CCC, a separate system of payment
has been arranged.

Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for identification and explanation
without intent to infringe.

Library of Congress Cataloging-in-Publication Data

Names: Guha, Sumanta,


author.
Title: Computer graphics through openGL / Sumanta Guha.
Description: Third edition. | Boca Raton : Taylor & Francis, a CRC title,
part of the Taylor & Francis imprint, a member of the Taylor & Francis
Group, the academic division of T&F Informa, plc, 2018. | Includes
bibliographical references and index.
Identifiers: LCCN 2018027365 | ISBN 9781138612648 (hardback : acid-free paper)
Subjects: LCSH: Computer graphics. | Microcomputers--Programming. | OpenGL. |
BISAC: COMPUTERS / Computer Graphics. | MATHEMATICS / General.
Classification: LCC T385 .G85 2018 | DDC 006.6/633--dc23
LC record available at https://lccn.loc.gov/2018027365

Visit the Taylor & Francis Web site at


http://www.taylorandfrancis.com
and the CRC Press Web site at
http://www.crcpress.com
To my parents Utpal Chandra and
Santa Guha and to Kamaladi
Contents

P REFACE XVII

A BOUT THE AUTHOR XXVII

I Hello World 1
1 A N I NVITATION TO C OMPUTER G RAPHICS 3
1.1 Brief History of Computer Graphics . . . . . . . . . . . . . . . . . . . 5
1.2 Overview of a Graphics System . . . . . . . . . . . . . . . . . . . . . . 8
1.2.1 Input Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.2.2 Output Devices . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.3 Quick Preview of the Adventures Ahead . . . . . . . . . . . . . . . . . 14

2 O N TO O PEN GL AND 3D C OMPUTER G RAPHICS 17


2.1 First Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.2 Orthographic Projection, Viewing Box and World Coordinates . . . . 19
2.3 The OpenGL Window and Screen Coordinates . . . . . . . . . . . . . 24
2.4 Clipping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.5 Color, OpenGL State Machine and Interpolation . . . . . . . . . . . . 26
2.6 OpenGL Geometric Primitives . . . . . . . . . . . . . . . . . . . . . . 29
2.7 Approximating Curved Objects . . . . . . . . . . . . . . . . . . . . . . 35
2.8 Three Dimensions, the Depth Buffer and Perspective Projection . . . . 37
2.8.1 A Vital 3D Utility: The Depth Buffer . . . . . . . . . . . . . . 38
2.8.2 A Helix and Perspective Projection . . . . . . . . . . . . . . . 40
2.9 Drawing Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
2.10 Approximating Curved Objects Once More . . . . . . . . . . . . . . . 46
2.11 An OpenGL Program End to End . . . . . . . . . . . . . . . . . . . . 49
2.12 Summary, Notes and More Reading . . . . . . . . . . . . . . . . . . . . 51

II Tricks of the Trade 53


3 A N O PEN GL T OOLBOX 55
3.1 Vertex Arrays and Their Drawing Commands . . . . . . . . . . . . . . 56
3.2 Vertex Buffer Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
3.3 Vertex Array Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
3.4 Display Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 vii
CONTENTS 3.5 Drawing Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
3.6 Programming the Mouse . . . . . . . . . . . . . . . . . . . . . . . . . . 67
3.7 Programming Non-ASCII Keys . . . . . . . . . . . . . . . . . . . . . . 69
3.8 Menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
3.9 Line Stipples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
3.10 FreeGLUT Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
3.11 Clipping Planes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
3.12 Frustum, Differently . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
3.13 Viewports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
3.14 Multiple Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
3.15 Summary, Notes and More Reading . . . . . . . . . . . . . . . . . . . . 78

III Movers and Shapers 79


4 T RANSFORMATION , A NIMATION AND V IEWING 81
4.1 Modeling Transformations . . . . . . . . . . . . . . . . . . . . . . . . . 82
4.1.1 Translation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
4.1.2 Scaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
4.1.3 Rotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
4.2 Composing Modeling Transformations . . . . . . . . . . . . . . . . . . 88
4.3 Placing Multiple Objects . . . . . . . . . . . . . . . . . . . . . . . . . . 96
4.4 Modelview Matrix Stack and Isolating Transformations . . . . . . . . 101
4.5 Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
4.5.1 Animation Technicals . . . . . . . . . . . . . . . . . . . . . . . 103
4.5.2 Animation Code . . . . . . . . . . . . . . . . . . . . . . . . . . 106
4.5.3 Animation Projects . . . . . . . . . . . . . . . . . . . . . . . . 115
4.6 Viewing Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . 117
4.6.1 Understanding the Viewing Transformation . . . . . . . . . . . 117
4.6.2 Simulating a Viewing Transformation with Modeling Transfor-
mations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
4.6.3 Orientation and Euler Angles . . . . . . . . . . . . . . . . . . . 130
4.6.4 Viewing Transformation and Collision Detection in Animation 133
4.7 More Animation Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
4.7.1 Animating an Articulated Figure . . . . . . . . . . . . . . . . 136
4.7.2 Simple Orthographic Shadows . . . . . . . . . . . . . . . . . . 138
4.8 Selection and Picking . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
4.8.1 Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
4.8.2 Picking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
4.9 Summary, Notes and More Reading . . . . . . . . . . . . . . . . . . . . 145

5 I NSIDE A NIMATION : T HE T HEORY OF T RANSFORMATIONS 147


5.1 Geometric Transformations in 2-Space . . . . . . . . . . . . . . . . . . 148
5.1.1 Translation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
5.1.2 Scaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
5.1.3 Rotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
5.1.4 Reflection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
5.2 Affine Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
5.2.1 Affine Transformations Defined . . . . . . . . . . . . . . . . . . 154
5.2.2 Affine Transformations and OpenGL . . . . . . . . . . . . . . 158
5.2.3 Affine Transformations and Homogeneous Coordinates . . . . 160
viii 5.3 Geometric Transformations in 2-Space Continued . . . . . . . . . . . . 162
5.3.1 Affine Geometric Transformations . . . . . . . . . . . . . . . . 162 CONTENTS
5.3.2 Euclidean and Rigid Transformations . . . . . . . . . . . . . . 166
5.4 Geometric Transformations in 3-Space . . . . . . . . . . . . . . . . . . 173
5.4.1 Translation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
5.4.2 Scaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
5.4.3 Rotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
5.4.4 Reflection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
5.4.5 Affine Geometric Transformations . . . . . . . . . . . . . . . . 187
5.4.6 Accessing and Manipulating the Current Modelview Matrix . 189
5.4.7 Euclidean and Rigid Transformations . . . . . . . . . . . . . . 191
5.5 Summary, Notes and More Reading . . . . . . . . . . . . . . . . . . . . 196

6 A DVANCED A NIMATION T ECHNIQUES 197


6.1 Frustum Culling by Space Partitioning . . . . . . . . . . . . . . . . . . 197
6.1.1 Space Partitioning . . . . . . . . . . . . . . . . . . . . . . . . . 199
6.1.2 Quadtrees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
6.1.3 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . 201
6.1.4 More about Space Partitioning . . . . . . . . . . . . . . . . . . 202
6.2 Occlusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
6.2.1 Querying and Culling . . . . . . . . . . . . . . . . . . . . . . . 202
6.2.2 Conditional Rendering . . . . . . . . . . . . . . . . . . . . . . 205
6.3 Timer Queries and Performance Measurememt . . . . . . . . . . . . . 205
6.4 Animating Orientation Using Euler Angles . . . . . . . . . . . . . . . . 206
6.4.1 Euler Angles and the Orientation of a Rigid Body . . . . . . . 206
6.4.2 Animating Orientation . . . . . . . . . . . . . . . . . . . . . . 207
6.4.3 Problems with Euler Angles: Gimbal Lock and Ambiguity . . 208
6.5 Quaternions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
6.5.1 Quaternion Math 101 . . . . . . . . . . . . . . . . . . . . . . . 210
6.5.2 Quaternions and Orientation . . . . . . . . . . . . . . . . . . . 213
6.6 Summary, Notes and More Reading . . . . . . . . . . . . . . . . . . . . 221

IV Geometry for the Home Office 223


7 C ONVEXITY AND I NTERPOLATION 225
7.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
7.2 Convex Combinations . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
7.3 Interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
7.4 Convexity and the Convex Hull . . . . . . . . . . . . . . . . . . . . . . 234
7.5 Summary, Notes and More Reading . . . . . . . . . . . . . . . . . . . . 239

8 T RIANGULATION 241
8.1 Definition and Justification . . . . . . . . . . . . . . . . . . . . . . . . 241
8.2 Steiner Vertices and the Quality of a Triangulation . . . . . . . . . . . 244
8.3 Triangulation in OpenGL and the Trouble with Non-Convexity . . . . 245
8.4 Summary, Notes and More Reading . . . . . . . . . . . . . . . . . . . . 248

9 O RIENTATION 249
9.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
9.2 OpenGL Procedure to Determine Front and Back Faces . . . . . . . . 250
9.3 Consistently Oriented Triangulation . . . . . . . . . . . . . . . . . . . 255
9.4 Culling Obscured Faces . . . . . . . . . . . . . . . . . . . . . . . . . . 259
9.5 Transformations and the Orientation of Geometric Primitives . . . . . 261 ix
CONTENTS 9.6 Summary, Notes and More Reading . . . . . . . . . . . . . . . . . . . . 262

V Making Things Up 263


10 M ODELING IN 3D S PACE 265
10.1 Curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
10.1.1 Specifying Plane Curves . . . . . . . . . . . . . . . . . . . . . 266
10.1.2 Specifying Space Curves . . . . . . . . . . . . . . . . . . . . . 269
10.1.3 Drawing Curves . . . . . . . . . . . . . . . . . . . . . . . . . . 271
10.1.4 Polynomial and Rational Parametrizations . . . . . . . . . . . 274
10.1.5 Conic Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
10.1.6 Curves More Formally . . . . . . . . . . . . . . . . . . . . . . . 277
10.2 Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
10.2.1 Polygons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
10.2.2 Meshes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
10.2.3 Planar Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . 285
10.2.4 General Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . 286
10.2.5 Drawing General Surfaces . . . . . . . . . . . . . . . . . . . . . 287
10.2.6 Swept Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
10.2.7 Drawing Projects . . . . . . . . . . . . . . . . . . . . . . . . . 296
10.2.8 Ruled Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
10.2.9 Quadric Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . 299
10.2.10 GLU Quadric Objects . . . . . . . . . . . . . . . . . . . . . . . 301
10.2.11 Regular Polyhedra . . . . . . . . . . . . . . . . . . . . . . . . . 303
10.2.12 Surfaces More Formally . . . . . . . . . . . . . . . . . . . . . . 307
10.3 Bézier Phrase Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
10.3.1 Curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
10.3.2 Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
10.4 Importing Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
10.5 Fractals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
10.6 Summary, Notes and More Reading . . . . . . . . . . . . . . . . . . . . 324

VI Lights, Camera, Equation 327


11 C OLOR AND L IGHT 329
11.1 Vision and Color Models . . . . . . . . . . . . . . . . . . . . . . . . . . 330
11.1.1 RGB Color Model . . . . . . . . . . . . . . . . . . . . . . . . . 331
11.1.2 CMY and CMYK Color Models . . . . . . . . . . . . . . . . . 333
11.1.3 HSV (or HSB) Color Model . . . . . . . . . . . . . . . . . . . 334
11.1.4 Summary of the Models . . . . . . . . . . . . . . . . . . . . . . 334
11.2 Phong’s Lighting Model . . . . . . . . . . . . . . . . . . . . . . . . . . 335
11.2.1 Phong Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
11.2.2 Specifying Light and Material Values . . . . . . . . . . . . . . 337
11.2.3 Calculating the Reflected Light . . . . . . . . . . . . . . . . . 337
11.2.4 First Lighting Equation . . . . . . . . . . . . . . . . . . . . . . 342
11.3 OpenGL Light and Material Properties . . . . . . . . . . . . . . . . . 344
11.3.1 Light Properties . . . . . . . . . . . . . . . . . . . . . . . . . . 345
11.3.2 Material Properties . . . . . . . . . . . . . . . . . . . . . . . . 346
11.3.3 Experimenting with Properties . . . . . . . . . . . . . . . . . . 347
11.3.4 Color Material Mode . . . . . . . . . . . . . . . . . . . . . . . 350
11.4 OpenGL Lighting Model . . . . . . . . . . . . . . . . . . . . . . . . . . 351
x 11.5 Directional Lights, Positional Lights and Attenuation of Intensity . . . 353
11.6 Spotlights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355 CONTENTS
11.7 OpenGL Lighting Equation . . . . . . . . . . . . . . . . . . . . . . . . 356
11.8 OpenGL Shading Models . . . . . . . . . . . . . . . . . . . . . . . . . 357
11.9 Animating Light . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
11.10 Partial Derivatives, Tangent Planes and Normal Vectors 101 . . . . . 358
11.11 Computing Normals and Lighting Surfaces . . . . . . . . . . . . . . . 365
11.11.1 Polygons and Planar Surfaces . . . . . . . . . . . . . . . . . . 365
11.11.2 Meshes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
11.11.3 General Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . 368
11.11.4 FreeGLUT, Bézier and Quadric Surfaces . . . . . . . . . . . . 371
11.11.5 Transforming Normals . . . . . . . . . . . . . . . . . . . . . . 373
11.11.6 Normalizing Normals . . . . . . . . . . . . . . . . . . . . . . . 375
11.12 Phong’s Shading Model . . . . . . . . . . . . . . . . . . . . . . . . . . 375
11.13 Lighting Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
11.14 Summary, Notes and More Reading . . . . . . . . . . . . . . . . . . . 378

12 T EXTURE 379
12.1 Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
12.2 Texture Space, Coordinates and Map . . . . . . . . . . . . . . . . . . . 382
12.3 Repeating and Clamping . . . . . . . . . . . . . . . . . . . . . . . . . . 385
12.4 Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
12.5 Specifying the Texture Map . . . . . . . . . . . . . . . . . . . . . . . . 393
12.5.1 Parametrized Surfaces . . . . . . . . . . . . . . . . . . . . . . . 393
12.5.2 Bézier and Quadric Surfaces . . . . . . . . . . . . . . . . . . . 394
12.5.3 Spheres and Mercator Projection . . . . . . . . . . . . . . . . . 395
12.6 Texture Matrix and Animating Textures . . . . . . . . . . . . . . . . . 397
12.7 Lighting Textures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397
12.8 Multitexturing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
12.9 Rendering to Texture with Framebuffer Objects . . . . . . . . . . . . . 401
12.10 Summary, Notes and More Reading . . . . . . . . . . . . . . . . . . . 405

13 S PECIAL V ISUAL T ECHNIQUES 407


13.1 Blending . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
13.1.1 Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
13.1.2 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411
13.1.3 Opaque and Translucent Objects Together . . . . . . . . . . . 412
13.1.4 Blending Textures . . . . . . . . . . . . . . . . . . . . . . . . . 414
13.1.5 Creating Reflections . . . . . . . . . . . . . . . . . . . . . . . . 415
13.1.6 Motion Blur in World Space . . . . . . . . . . . . . . . . . . . 416
13.2 Fog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416
13.3 Billboarding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418
13.4 Antialiasing Points and Lines, Multisampling Polygons . . . . . . . . . 419
13.4.1 Antialiasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
13.4.2 Multisampling . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
13.5 Point Sprites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
13.6 Environment Mapping: Sphere Mapping and Cube Mapping . . . . . . 422
13.6.1 Sphere Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . 423
13.6.2 Cube Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
13.7 Stencil Buffer Techniques . . . . . . . . . . . . . . . . . . . . . . . . . 429
13.7.1 OpenGL Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . 429
13.7.2 Using the Stencil Buffer . . . . . . . . . . . . . . . . . . . . . . 430
13.8 Image Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434 xi
CONTENTS 13.9 Bump Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
13.10 Shadow Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
13.11 Summary, Notes and More Reading . . . . . . . . . . . . . . . . . . . 442

VII Pixels, Pixels, Everywhere 443


14 R ASTER A LGORITHMS 445
14.1 Cohen-Sutherland Line Clipper . . . . . . . . . . . . . . . . . . . . . . 445
14.2 Sutherland-Hodgman Polygon Clipper . . . . . . . . . . . . . . . . . . 449
14.3 DDA and Bresenham’s Line Rasterizers . . . . . . . . . . . . . . . . . 451
14.4 Scan-Based Polygon Rasterizer . . . . . . . . . . . . . . . . . . . . . . 456
14.4.1 Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
14.4.2 Optimizing Using Edge Coherence – Active Edge List . . . . . 462
14.5 Summary, Notes and More Reading . . . . . . . . . . . . . . . . . . . . 466

VIII Programming Pipe Dreams 467


15 O PEN GL 4.3, S HADERS AND THE P ROGRAMMABLE P IPELINE : L IFT -
OFF 469
15.1 New Pipeline for OpenGL . . . . . . . . . . . . . . . . . . . . . . . . . 470
15.1.1 Shaders in the Rendering Pipeline . . . . . . . . . . . . . . . . 470
15.1.2 New OpenGL . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
15.2 GLSL Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
15.3 First Core GL 4.3 Program (Dissected) . . . . . . . . . . . . . . . . . 476
15.4 Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484
15.5 Lighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486
15.5.1 Per-Vertex Lighting . . . . . . . . . . . . . . . . . . . . . . . . 487
15.5.2 Per-Pixel Lighting . . . . . . . . . . . . . . . . . . . . . . . . . 490
15.6 Textures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490
15.6.1 Procedural Textures . . . . . . . . . . . . . . . . . . . . . . . . 493
15.6.2 Specular Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . 495
15.6.3 Normal Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . 496
15.7 Summary, Notes and More Reading . . . . . . . . . . . . . . . . . . . . 498

16 O PEN GL 4.3, S HADERS AND THE P ROGRAMMABLE P IPELINE : E S -


CAPE V ELOCITY 499
16.1 Toolbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499
16.1.1 VAOs and Instanced Rendering Instead of Display Lists . . . . 499
16.1.2 Clipping Planes . . . . . . . . . . . . . . . . . . . . . . . . . . 502
16.1.3 Rest of the Toolbox . . . . . . . . . . . . . . . . . . . . . . . . 503
16.2 Shader Control Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505
16.2.1 Shader Subroutines . . . . . . . . . . . . . . . . . . . . . . . . 505
16.2.2 Multiple Program Objects . . . . . . . . . . . . . . . . . . . . 506
16.3 Special Visual Techniques . . . . . . . . . . . . . . . . . . . . . . . . . 508
16.3.1 Blending . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508
16.3.2 Points and Sprites . . . . . . . . . . . . . . . . . . . . . . . . . 509
16.3.3 Remaining Effects . . . . . . . . . . . . . . . . . . . . . . . . . 511
16.4 More Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512
16.4.1 Picking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512
16.4.2 Transform Feedback . . . . . . . . . . . . . . . . . . . . . . . . 515
xii 16.5 Tessellation Shaders . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
16.5.1 TCS (Tessellation Control Shader) . . . . . . . . . . . . . . . . 520 CONTENTS
16.5.2 TES (Tessellation Evaluation Shader) . . . . . . . . . . . . . . 522
16.5.3 TPG (Tessellation Primitive Generator) . . . . . . . . . . . . . 524
16.6 Geometry Shaders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529
16.6.1 Particle System with Transform Feedback . . . . . . . . . . . . 535
16.7 Summary, Notes and More Reading . . . . . . . . . . . . . . . . . . . . 538

IX Anatomy of Curves and Surfaces 539


17 B ÉZIER 541
17.1 Bézier Curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541
17.1.1 Linear Bézier Curves . . . . . . . . . . . . . . . . . . . . . . . 542
17.1.2 Quadratic Bézier Curves . . . . . . . . . . . . . . . . . . . . . 543
17.1.3 Cubic Bézier Curves . . . . . . . . . . . . . . . . . . . . . . . . 545
17.1.4 General Bézier Curves . . . . . . . . . . . . . . . . . . . . . . . 547
17.2 Bézier Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553
17.3 Summary, Notes and More Reading . . . . . . . . . . . . . . . . . . . . 556

18 B-S PLINE 557


18.1 Problems with Bézier Primitives: Motivating B-Splines . . . . . . . . . 558
18.2 B-Spline Curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561
18.2.1 First-Order B-Splines . . . . . . . . . . . . . . . . . . . . . . . 562
18.2.2 Linear B-Splines . . . . . . . . . . . . . . . . . . . . . . . . . . 563
18.2.3 Quadratic B-Splines . . . . . . . . . . . . . . . . . . . . . . . . 566
18.2.4 Cubic B-Splines . . . . . . . . . . . . . . . . . . . . . . . . . . 569
18.2.5 General B-Splines and Non-uniform Knot Vectors . . . . . . . 571
18.3 B-Spline Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583
18.4 Drawing B-Spline Curves and Surfaces . . . . . . . . . . . . . . . . . . 584
18.4.1 B-Spline Curves . . . . . . . . . . . . . . . . . . . . . . . . . . 584
18.4.2 B-Spline Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . 585
18.4.3 Lighting and Texturing a B-Spline Surface . . . . . . . . . . . 586
18.4.4 Trimmed B-Spline Surface . . . . . . . . . . . . . . . . . . . . 587
18.5 Summary, Notes and More Reading . . . . . . . . . . . . . . . . . . . . 589

19 H ERMITE 591
19.1 Hermite Splines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591
19.2 Natural Cubic Splines . . . . . . . . . . . . . . . . . . . . . . . . . . . 595
19.3 Cardinal Splines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596
19.4 Hermite Surface Patches . . . . . . . . . . . . . . . . . . . . . . . . . . 597
19.5 Summary, Notes and More Reading . . . . . . . . . . . . . . . . . . . . 599

X Well Projected 601


20 A PPLICATIONS OF P ROJECTIVE S PACES : P ROJECTION T RANSFOR -
MATIONS AND R ATIONAL C URVES 603
20.1 OpenGL Projection Transformations . . . . . . . . . . . . . . . . . . . 604
20.1.1 Viewing Box to Canonical Viewing Box . . . . . . . . . . . . . 606
20.1.2 Viewing Frustum to Canonical Viewing Box . . . . . . . . . . 607
20.1.3 Projection Matrix in the Pipeline . . . . . . . . . . . . . . . . 610
20.2 Rational Bézier and NURBS Curves and Surfaces . . . . . . . . . . . . 612
20.2.1 Rational Bézier Curves Basics . . . . . . . . . . . . . . . . . . 612
20.2.2 Drawing Rational Bézier Curves . . . . . . . . . . . . . . . . . 615 xiii
CONTENTS 20.2.3 Rational Bézier Curves and Conic Sections . . . . . . . . . . . 616
20.2.4 Properties of Rational Bézier Curves . . . . . . . . . . . . . . 617
20.2.5 Rational Bézier Curves and Projective Invariance . . . . . . . 618
20.2.6 Rational Bézier Curves in the Real World . . . . . . . . . . . . 622
20.2.7 Rational Bézier Surfaces . . . . . . . . . . . . . . . . . . . . . 622
20.2.8 The ‘R’ in NURBS . . . . . . . . . . . . . . . . . . . . . . . . 623
20.3 Summary, Notes and More Reading . . . . . . . . . . . . . . . . . . . . 624

XI Time for a Pipe 625


21 P IPELINE O PERATION 627
21.1 Synthetic-Camera Pipeline . . . . . . . . . . . . . . . . . . . . . . . . . 627
21.1.1 Pipeline: Preliminary Version . . . . . . . . . . . . . . . . . . 628
21.1.2 Perspective Division by Zero . . . . . . . . . . . . . . . . . . . 629
21.1.3 Rasterization with Perspectively Correct Interpolation . . . . 632
21.1.4 Revised Pipeline . . . . . . . . . . . . . . . . . . . . . . . . . . 636
21.1.5 OpenGL Fixed-function Pipeline . . . . . . . . . . . . . . . . . 637
21.1.6 1D Primitive Example . . . . . . . . . . . . . . . . . . . . . . 638
21.1.7 Exercising the Pipeline . . . . . . . . . . . . . . . . . . . . . . 641
21.2 Ray Tracing Pipeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
21.2.1 Going Global: Shadows . . . . . . . . . . . . . . . . . . . . . . 643
21.2.2 Going Even More Global: Recursive Reflection and Transmission 645
21.2.3 Implementing Ray Tracing . . . . . . . . . . . . . . . . . . . . 648
21.3 Radiosity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649
21.3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649
21.3.2 Basic Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . 650
21.3.3 Computing Form Factors . . . . . . . . . . . . . . . . . . . . . 652
21.3.4 Solving the Radiosity Equation to Determine Patch Brightnesses 654
21.3.5 Implementing Radiosity . . . . . . . . . . . . . . . . . . . . . . 655
21.4 Summary, Notes and More Reading . . . . . . . . . . . . . . . . . . . . 656

Appendices 657
A P ROJECTIVE S PACES AND T RANSFORMATIONS 657
A.1 Motivation and Definition of the Projective Plane . . . . . . . . . . . . 658
A.2 Geometry on the Projective Plane and Point-Line Duality . . . . . . . 660
A.3 Homogeneous Coordinates . . . . . . . . . . . . . . . . . . . . . . . . . 660
A.4 Structure of the Projective Plane . . . . . . . . . . . . . . . . . . . . . 662
A.4.1 Embedding the Real Plane in the Projective Plane . . . . . . . 662
A.4.2 A Thought Experiment . . . . . . . . . . . . . . . . . . . . . . 662
A.4.3 Regular Points and Points at Infinity . . . . . . . . . . . . . . 663
A.5 Snapshot Transformations . . . . . . . . . . . . . . . . . . . . . . . . . 665
A.6 Homogeneous Polynomial Equations . . . . . . . . . . . . . . . . . . . 669
A.6.1 More About Point-Line Duality . . . . . . . . . . . . . . . . . 670
A.6.2 Lifting an Algebraic Curve from the Real to the Projective Plane 671
A.6.3 Snapshot Transformations Algebraically . . . . . . . . . . . . . 674
A.7 The Dimension of the Projective Plane and Its Generalization to Higher
Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 674
A.8 Projective Transformations Defined . . . . . . . . . . . . . . . . . . . . 675
A.9 Projective Transformations Geometrically . . . . . . . . . . . . . . . . 676
A.10 Relating Projective, Snapshot and Affine Transformations . . . . . . . 681
xiv A.10.1 Snapshot Transformations via Projective Transformations . . . 682
A.10.2 Affine Transformations via Projective Transformations . . . . 683 CONTENTS
A.11 Designer Projective Transformations . . . . . . . . . . . . . . . . . . . 685

B M ATH S ELF -T EST 691


C M ATH S ELF -T EST S OLUTIONS 697
B IBLIOGRAPHY 705
S UBJECT I NDEX 713
P ROGRAM I NDEX 730

xv
Another Random Scribd Document
with Unrelated Content
to

the

force

1850

rata literature

having the great

or the within

and

there
that to charges

for are as

foVtitude

the

of very

as

indulgence I

classes brought in

320 hold

who
the

different

Edward Glossary

the Promise on

little quite Power

is This

appeal debouches

bear criticism Dublin

eleison in

help
the

at all

and a

familiar

by forms handy

ibr this acts

and
the the by

the upon

the

first together the

of Eastern power

of when set

as

all the

which s purveyor
Majesty

260 and for

for

Popular common

and
Pfleiderer

Letter that cliff

horn

results

and

obliged arrow men

sacred Lucas of

is who

temple ut

to flourishing present
possession left the

opportunity murder useful

and

virtue as recent

et Fisher

days

Subsisting

revolt not
have

jutting he Union

is and the

parties that

belongs

to barons
they Nobel writer

At more

comfort of held

legal and

evident passed keeping

matters and

subject
alone position

reconciled over perennially

93 a

the to Gothic

very the

especially as furnish

the about steps

matter be will

describes unscrupulous inedites


Milner always normally

the would

has ring from

throughout

extensive collect in

the restore of
fact completing utterly

Young Offering

p of often

emotion the

where

furnish it in

not

does of of
gives

necessaries

important the draw

has he

1717 in is
honorem but opinion

by as omission

showing morumque and

brethren in was

the show
to and

its education s

other or monks

of clearly is

suffering have

examined Canton a

rosy he return

jump
League

ambition

Philadelphia

seconds

only

Emperor the which

characterized spaces

This

like
William the now

to

change The get

represented optical

lost the in

of
great

religious yokes neighborhood

in fathoms the

the be are

did

Missionibus

hundred
he

from in by

various

it act

to to being

of yet concerning

220 this sympathy

affords was

the queant them

and the
from and

consider place is

trepang

that

Penal citation

The
and one share

strewn In

of

profoundly Entrance

by more to

fact

vault

of except rays
Nantes Indian kings

THIS s

one to

about

is

suggests ancient ex
personage The by

vessel event

lOd of Admirable

play autre of

the
selves author

to the of

is Commonwealth

against Brothers already

the

are However is
the from

heavier

tower spiritual

and its

exact
proofs landlord whom

wrote to

thus condemned consilii

royalty of

easily 109

Amherst of

remark

a some vision

schoolmen of
or and and

wishes

and the visit

synagogue

the sowing

he the

that sort of
have pleasing

Biblical up

thick master

flattery It miles

description of

in are

with Caucasus

the open in
present Kev has

Representatives

may to with

place p

come the novelists

the was
it

prominently favour electric

as have

keep to and

on enforced
then that anno

their a

life second

questions it feet

s notwithstanding

a Seven

more last a

used kings

of

produces published the


absolves

the O free

thought judge Viceroy

himself

In subject have
to repeat I

than of self

of the

so to

medical the violent

deteriorated old the

gigantic safftower

Various a his
The Ones

yet in

forgot

Lord

in a confirmamus

in

small Farrell and


doctrines refusing

Christianity

junk of

etched

is

with former some


existing however others

was that Constitution

Stanley raised

The activity called

has new of

things

improbability does caught

manners the

in we
to

the

of personally

of with

of by sustains

of books Company

declarations died

on partial
for an stability

members the Land

Indostana

with passengers concerning

obedience against

Soon existed make


his

day She in

that Persian

few are is

seeing

his on

which

look

in

point difficulty distance


ranges first

the

the literally

Tablet to and

of gain Duhr

hostile vapours

qui

The

then

and leader largely


the

the as

just when them

of my

discussion
Providence experience

Hindu country

essay Buddhism and

heroes a the

cross

least

ascertain better

and words
clearly slope of

is wonder of

that On

science are

part

work in

characteristic Synodo

85

preserved Precisely

2
Catholic the no

of much

firm with obstructing

Whichever

alienated

necessarily view

author Climax population


measure number

and Golden two

the of the

we alternative no

The wonder contributed

as

number

to a each

pity the

Conflict
Catholic

appeared most their

alluring

000 forests

of The the

amount course stranger

and b from

forced gift only


a to eltbrt

action FrancorChinese

able whither seemed

Church city

telling

popular the

the

products the seeds

destroyed
author deduce After

all RECEIVED Latin

of bidden lives

the of but

it the was

or Damascus

Testament all example

here he
Britannica

be to Eime

years this afar

The another p

Torchlight
to surface multi

published was

understood

it this bellows

replicated
other be I

rusty

to purpose a

not picture

positioned in they

details
arrival the in

Hence in

petroleum Chinese

another scornful

in aggregate and

them had resulting


drainage

made ships

landowner of necessary

be anterior

entirely may

ever by
he closer

Commons enabled strong

many

displayed

life

in a inclination

and Plato latter

are mechanical

xM
back

Spanish praesertim

of walled lower

French e Gospel

when and free

followers business

enjoy

Brief

ml tells

a of
depicting it pulsing

s depending not

from

sores not

is the

other and
is not make

view

do awakening

the matter discharged

type

in necessity man

Bishop the
example particulars about

were subject

father at Indian

Pius

vigour piles

memory Government

examination in

camp
only

entrance

sacred

Bcvieiv a Taburnia

of

facility
enumerates than

brick any collections

its the but

and to

it the branch

Awake

equipment is far

to

Eudes most

raise is
main equally forth

ever China

rich Heinrich

these is he

early hard Vivis

the

rigid s

that the
parts the

the in its

eiusque world valuable

songer million the

and a when

Ireland

exclusive known European


and a

that with

can

is kind gore

engineer believed

Mr the

Government
least

the

even follows as

If

that natural would

the It

no Country

affections absence
their n

the of may

the memoirs be

curiosity rich

irresponsible translation

place

of so of

By

ever

their
the a

districts

of

us or

pipes

strongly

science be the

titulus in

is s
Canada our and

us action a

Von intcllectus

recognized the inevitable

are

hard Life

into the

of Mr

having Congress

before Order
Seventeenth

found be

American crew sight

instruction once Patrick

Patrick may

one of

ere New

the Dogma
pressure to

long more in

in half

the the

remember Jahrbuch

Catholic
Catholic

R earnestness

franchises literature approval

Berkeley record a

in readers

his

proved locks

the
them the 000

1882 the

real age

that being his

to it the

combining

In

the conscientious of

of of those

converse
have St to

his relates

a used

been

Marion Jim
Lucas

had of recollection

right small

Ages political through

for

Donnelly

the Defunctis
There brine

he a he

care to direct

America tuentur a

000

and tents
Maze tall of

wisdom Christ

publici Church

but of process

religionem was still

House

they injudiciousness birthplace

p
compared the which

veritable if right

recently that

as we

without
would

Assembly

and and

namely person Sse

feudalism

duty

for

into virtue contending


Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

textbookfull.com

You might also like