Slashdot Mirror


OpenGL Programming Guide

Martin Ecker writes "The Red Book, also known as the OpenGL Programming Guide, is back in its fifth edition. It received the name Red Book because of the nice red book cover, and possibly also because it has remained the standard introductory text on the OpenGL graphics API for years, and always referring to it as "OpenGL Programming Guide" is too long. This fifth edition now also covers new features introduced with versions 1.5 and 2.0 of the OpenGL standard. So let me take you on a tour through the pages of this book to see what it has to offer." Ecker's review continues below. OpenGL Programming Guide (5th Ed.) - The Official Guide to Learning OpenGL, Version 2 author Dave Shreiner, Mason Woo, Jackie Neider, Tom Davis pages 838 publisher Addison-Wesley Publishing rating 8 reviewer Martin Ecker ISBN 0321335732 summary A very complete and thorough introduction to OpenGL

I should mention that the last edition I read of the Red Book was the first edition, and a lot of material has been added to the book in the meantime. Just as the first edition, however, the fifth edition is still incredibly complete and thorough. It contains explanations of pretty much every feature of OpenGL, even the rarely used ones. You want to know about the new occlusion queries added to OpenGL recently? It's in this book. You want to know about the accumulation buffer and its uses? It's in this book. You want to know about the (mostly deprecated) use of indexed color buffers? It's in this book. The only thing the book does not cover in detail is vertex and fragment shaders because they have their own book, the Orange Book (aka The OpenGL Shading Language) -- see my previous Slashdot review.

The Red Book is aimed at the beginning to intermediate graphics programmer who is not yet familiar with OpenGL. It assumes a basic background in computer graphics theory and working knowledge of the C programming language. The book consists of 15 chapters and 9 appendices that together span approximately 800 pages.

The first chapter gives a brief introduction to the basic concepts of OpenGL and describes the rendering pipeline model used in the API. GLUT, a cross-platform library that allows easily creating OpenGL applications, is also shortly discussed together with a program that shows GLUT in action. The following chapters proceed to explain the basic geometric primitives, such as lines and polygons, supported by OpenGL and how to render them in different positions and from different viewpoints using the various OpenGL matrix stacks. The authors also discuss here the basics of using colors, fixed-function lighting, framebuffer blending, and fog.

Chapter seven contains a description of display lists, a unique feature of OpenGL that allows to store OpenGL API calls for efficient multiple use later on in a program. Chapter eight then moves on to discuss what an image is for OpenGL, which brings us straight to chapter nine on texture mapping, one of the largest chapters in the book. This chapter discusses everything you need to know on textures, from specifying texture images in uncompressed and compressed form to applying textures to primitives using the various kinds of supported texture filters. Also depth textures and their application as shadow maps are presented.

In chapter ten the authors discuss the buffers that make up the framebuffer, such as the color buffer, depth buffer, and stencil buffer. This chapter summarizes some of the things already presented in the earlier chapters and then describes the various framebuffer operations in more detail. Also the accumulation buffer and its uses, such as motion blur and depth of field effects, are discussed. Chapter eleven and twelve are on the tools provided by GLU, the GL utility library, in particular tesselators, quadrics, evaluators, and NURBs. GLU is nowadays rarely ever used in production code, so these chapters mostly demonstrate just how complete the Red Book is in its coverage of OpenGL. This also applies to chapter thirteen on selection and feedback, which are rarely used features, mostly because of the lack of hardware acceleration.

Finally, chapter fourteen is a collection of topics that didn't fit into the other chapters, such as error handling and the OpenGL extension mechanism. Additionally, this chapter presents various higher level techniques and tricks, for example how to implement a simple fade effect, how to render antialiased text, and some examples of using the stencil buffer. The final chapter of the book - newly added in the fifth addition -- is a short introduction to the OpenGL Shading Language (GLSL, for short). Even though the OpenGL API functions required to use GLSL are presented, this is only a quick overview of how programmable shaders are used in OpenGL. For a more detailed description of GLSL the reader is referred to the Orange Book.

The book closes with quite a few appendices on the order of operations in the OpenGL rendering pipeline, the state variables that can be queried, the interaction of OpenGL with the operating system-specific windowing systems, a brief discussion of homogeneous coordinates as used in OpenGL, and some programming tips. Also a reference of the built-in GLSL variables and functions is included, which is a bit odd considering that the Red Book actually doesn't really concentrate on programmable shaders or GLSL. It's a good reference nevertheless.

The book contains a large number of images and diagrams, all of them in black and white except for 32 color plates in the middle of the book. The illustrations are of high quality and generally help make the explained concepts and techniques easier to understand. Most of the color plates depict spheres, teapots, and other simple geometric objects, so they aren't overly eye-catching but do serve their purpose of showing what can be achieved with OpenGL.

The Red Book remains the definitive guide to learning OpenGL. Whenever someone asks me "What book should I read first to learn OpenGL?" this is the book I refer them to. Apart from being a good introduction, it also contains many interesting tips and tricks that make the experienced OpenGL programmer come back to it often. If you've read through this book in its entirety you pretty much know everything there is to know about OpenGL.

Martin Ecker has been involved in real-time graphics programming for more than 9 years and works as a games developer for casual arcade games. In his rare spare time he works on a graphics-related open source project called XEngine. You can purchase OpenGL Programming Guide (5th Ed.) - The Official Guide to Learning OpenGL, Version 2 from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

16 of 143 comments (clear)

  1. What about this site? by irtza · · Score: 5, Interesting

    How does this new version compare to this site: The red book?? Is it worth the money to buy it if you are a true beginner with a decent C background, but little prior work with 3D graphics? Or would it be fair to say that the online book would suffice and that a API reference for changes and updates would allow you to do simple rendering?

    --
    When all else fails, try.
    1. Re:What about this site? by pstreck · · Score: 4, Informative

      thats the 1st edition up there. If you are serious about writing with the opengl api, I highly reccomend getting the latest revision.

      --

      Later,
      Phil
  2. Try before you buy... by Anonymous Coward · · Score: 5, Informative

    Book is available online here (and a few other places/formats, try google):

    http://fly.cc.fer.hr/~unreal/theredbook/

    This is an older version, but still a very good grounding in the basics of interactive 3d graphics.

    1. Re:Try before you buy... by Kjellander · · Score: 4, Informative

      That one is an old version. Get Edition 4 here instead:

      http://opengl.org/documentation/red_book_1.0/

      Don't know if the fifth is online yet.

    2. Re:Try before you buy... by shawnkirst · · Score: 3, Informative

      That's only a sample chapter from Edition 4. The rest of the links are for the first edition.

  3. The Red Book is not the Blue Book by webbroberts · · Score: 5, Informative

    The reason they call it the red book is to distinguish it from the blue book, which is the OpenGL reference manual.

    http://www.opengl.org/documentation/blue_book_1.0/

  4. Figures by iSlak · · Score: 3, Funny

    Damn it! I just bought the 4th edition two days ago on Amazon.

  5. Free version by Anonymous Coward · · Score: 5, Informative

    You can get this book in PDF or HTML for free from here. Obviously it's as up to date as this edition but probably good enough for most beginners.

  6. games by BillFarber · · Score: 3, Funny

    Maybe the people who complain about the lack of quality games should put the book to use.

  7. That's not the red book! by merreborn · · Score: 4, Funny

    I've seen "Hackers"! They use the Red Book to hack the Gibson.

    Also, hacking looks a lot like a bad screensaver. There's never any text editing or commandlines involved.

    1. Re:That's not the red book! by cwebster · · Score: 4, Informative

      no, that would be this red book

  8. Covers & Colors by Anonymous Coward · · Score: 5, Informative

    The thing about these OpenGL books that makes them different from all the others on the market is that they are DEFINITIVE. They are put out by the OpenGL Architecture Review Board - who are the very people who design and update the API. If the books don't agree with the implementation - it's the implementation that's wrong!

    The full set are as follows:

    Red Book - Programming guide - chatty description which still has all of the arguments of all of the functions described within it. You *need* this book...expect to buy a new one every couple of years as the API evolves. Keep one copy at work and the last generation one at home...maybe keep the one before that in your car!

    Blue Book - Reference Manual - quite literally a set of 'man' pages printed out and bound together in a book. Useful if you like to read books instead of screens.

    Green Book - GLUT. Covers the GL Utility Toolkit. This is really rather unnecessary.

    Alpha Book - OpenGL programming for Windows. (It actually has a white cover...but since we had the RGB books, we needed Alpha to complete the set!)

    Orange Book - OpenGL shader language (GLSL). If you want to program at the cutting edge of realtime graphics, you'll be using shaders. It's written in a style broadly similar to the way the Red Book is written and is very readable.

    Finally, there is the OpenGL specification document. This has (AFAIK) never been put into print (which is a great shame - I'd buy it) - you can download it from www.opengl.org and it contains VERY detailed documentation of every function that goes far beyond any of the printed manuals - but which presumes you already know OpenGL pretty well. However, if you need to know the mathematical description of how OpenGL implementations are supposed to calculate the level of detail of your texture map...this is where you'll find that.

    Whilst all the other books are handy to have around, the RedBook is utterly essential to OpenGL programmers (even those of us who've been using it for the whole eleven years of it's life will find themselves referring to it often enough to warrant owning a copy). The nice thing about it is that it's very readable. You can open it at page 1 knowing nothing - and read through to the end and wind up having learned all of OpenGL - or you can pretend it's a set of man pages and use the (excellent) index to find a simple description of every function and it's arguments that's *NEARLY* as good as the Blue Book.

  9. Re:Microsoft by Decimal+Dave · · Score: 4, Informative

    Microsoft's OGL wrapper for DirectX does add a lot of overhead, but it doesn't matter - hardly anyone uses that. Normally under Windows you use the OpenGL implementation that comes from the graphics chipset manufacturer. NVIDIA, ATI, 3DLabs, etc. all have their own, which can be very fast without any sort of DirectX involvement. These are generally much more up to data than MS OGL anyway.

    --

    "Leave the strategizing to those of us with planet-sized brains." -Tycho
  10. Re:Microsoft by 2008 · · Score: 3, Insightful

    A gamer craves not these things.

    Seriously, not only are games full-screen most of the time, but I would much rather have my graphics card working on my framerate than transparent jiggly menus.

    --
    I quit!
  11. Re:Too Bad OpenGL Is Getting Crippled by brain007 · · Score: 5, Informative

    It's great that you jump on the freak out bandwagon. MS has tried to kill OpenGL before and they will try again. It's not going to be that big of a deal. OpenGL is used way more then DirectX for everything non-games (yes, there is a world out there that doesn't involve games). Here's a clue for everyone who is freaking out about this and doesn't mind having an open mind and learning a thing or two in the process.

  12. Re:Making DirectX faster isn't the issue by egoots · · Score: 3, Informative

    What they are doing is layering the opengl icd on top of directx, freezing it at 1.4, disallowing extensions, and NOT providing info to 3rd parties to implement their own icd driver... Net result it will be 50% slower. See http://en.wikipedia.org/wiki/Opengl for details (scroll to "Future in Microsoft Windows").

    If true, it sure sounds like they are hobbling Opengl