About This E-Book
EPUB is an open, industry-standard format for e-books. However, support for EPUB and its many features varies across reading devices
and applications. Use your device or app settings to customize the presentation to your liking. Settings that you can customize often include font,
font size, single or double column, landscape or portrait mode, and figures that you can click or tap to enlarge. For additional information about
the settings and features on your reading device or app, visit the device manufacturer’s Web site.
Many titles include programming code or configuration examples. To optimize the presentation of these elements, view the e-book in single-
column, landscape mode and adjust the font size to the smallest setting. In addition to presenting code and configurations in the reflowable text
format, we have included images of the code that mimic the presentation found in the print book; therefore, where the reflowable format may
compromise the presentation of the code listing, you will see a “Click here to view code image” link. Click the link to view the print-fidelity code
image. To return to the previous page viewed, click the Back button on your device or app.
OpenGL
®
Programming Guide
Ninth Edition
The Official Guide to Learning OpenGL
®
, Version 4.5 with SPIR-V
John Kessenich
Graham Sellers
Dave Shreiner
Boston • Columbus • Indianapolis • New York • San Francisco • Amsterdam • Cape Town
Dubai • London • Madrid • Milan • Munich • Paris • Montreal • Toronto • Delhi • Mexico City
São Paulo • Sydney • Hong Kong • Seoul • Singapore • Taipei • Tokyo
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 the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all
capitals.
The authors and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume
no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the
use of the information or programs contained herein.
For information about buying this title in bulk quantities, or for special sales opportunities (which may include electronic versions; custom cover
designs; and content particular to your business, training goals, marketing focus, or branding interests), please contact our corporate sales
department at corpsales@pearsoned.com or (800) 382-3419.
For government sales inquiries, please contact governmentsales@pearsoned.com .
For questions about sales outside the U.S., please contact intlcs@pearson.com .
Visit us on the Web: informit.com/aw
Library of Congress Control Number: 2016939338
Copyright © 2017 Pearson Education, Inc.
All rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the
publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical,
photocopying, recording, or likewise. For information regarding permissions, request forms and the appropriate contacts within the Pearson
Education Global Rights & Permissions Department, please visit www.pearsoned.com/permissions/ .
ISBN-13: 978-0-13-449549-1
ISBN-10: 0-13-449549-7
Text printed in the United States on recycled paper at RR Donnelley in Crawfordsville, Indiana.
First printing, July 2016
Praise for previous editions of OpenGL
®
Programming Guide
“Wow! This book is basically one-stop shopping for OpenGL information. It is the kind of book that I will be reaching for a lot.
Thanks to Dave, Graham, John, and Bill for an amazing effort.”
—Mike Bailey, professor, Oregon State University
“The most recent Red Book parallels the grand tradition of OpenGL; continuous evolution towards ever-greater power and
efficiency. The eighth edition contains up-to-the minute information about the latest standard and new features, along with a solid
grounding in modern OpenGL techniques that will work anywhere. The Red Book continues to be an essential reference for all new
employees at my simulation company. What else can be said about this essential guide? I laughed, I cried, it was much better than
Cats—I’ll read it again and again.”
—Bob Kuehne, president, Blue Newt Software
“OpenGL has undergone enormous changes since its inception twenty years ago. This new edition is your practical guide to using the
OpenGL of today. Modern OpenGL is centered on the use of shaders, and this edition of the Programming Guide jumps right in, with
shaders covered in depth in Chapter 2 . It continues in later chapters with even more specifics on everything from texturing to
compute shaders. No matter how well you know it or how long you’ve been doing it, if you are going to write an OpenGL program,
you want to have a copy of the OpenGL
®
Programming Guide handy.”
—Marc Olano, associate professor, UMBC
“If you are looking for the definitive guide to programming with the very latest version of OpenGL, look no further. The authors of this
book have been deeply involved in the creation of OpenGL 4.3, and everything you need to know about the cutting edge of this
industry-leading API is laid out here in a clear, logical, and insightful manner.”
—Neil Trevett, president, Khronos Group