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.

17 of 143 comments (clear)

  1. Microsoft by Anonymous Coward · · Score: 1, Informative

    There's still the problem of Windows Vista making DirectX much faster than OpenGL.

    1. 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
    2. Re:Microsoft by Edgewize · · Score: 2, Informative

      False. Additional frames pass too quickly to be perceived as individual images, but they still add to the perception of smooth motion.

    3. Re:Microsoft by JourneyExpertApe · · Score: 2, Informative
      I'm not entirely sure that this is the case. The news item currently at the top of opengl.org is:
      Full performance OpenGL under Windows Vista Aero - Contact your hardware and software manufacturers Microsoft's current plan for OpenGL on Windows Vista is to layer OpenGL over Direct3D in order to use OpenGL with a composited desktop to obtain the Aeroglass experience. If an an application runs using an OpenGL ICD - the desktop compositor will switch off - significantly degrading the user experience. This is only a first technical beta of Vista, so this is a problem that can be solved. Write to your preferred software developer, hardware developer and video card manufacturer (e.g. 3Dlabs, ATI, Intel, Matrox, NVIDIA, SIS HP, Dell, Leenovo) and tell them to bring this up with Microsoft. Hardware and software vendors do listen to the developers. This will be the most effective action you can take. Don't be passive - send those emails and keep the topic in the foreground
      OpenGL under Windows works like this:
      you pick a graphics mode, which may be provided by MS (software) or by the hardware manufacturer (accelerated).

      According to the text from OpenGL.org, most OGL applications (which use ICD) will indead run through the DirectX layer. If MS is making hardware manufacturers go through DirectX, then I think this will be a big problem. If you are at all concerned with this issue, then I suggest you read up on the history of OpenGL on Windows.
      --
      If you can read this sig, you're too close.
  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. 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
  4. 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/

  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. Save Some 1.57%! by Anonymous Coward · · Score: 1, Informative

    Save yourself some money by buying the book here and using the "secret" 1.57% A9 discount you get by using a9.com: OpenGL Programming Guide

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

    no, that would be this red book

  8. Re:What about this site? by TomorrowPlusX · · Score: 2, Informative

    Sorry about the rant.

    To answer your actual question, you *do* need a relatively modern API reference, if you're studying from the 1.1 spec ( I learned off the 1.2 spec ). But the thing is, OpenGL is very well backwards compatible, so code written for the first edition will work fine on a modern OpenGL 2 driver.

    Still, but it: It's a good book. I went from *zero* opengl experience to My mediocre game in 1.5 years, with a robotics simulator in the interim.

    --

    lorem ipsum, dolor sit amet
  9. 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.

  10. NeHe not so great by Anonymous Coward · · Score: 1, Informative

    I don't recommend using NeHe any more. At one point, it was a great resource, but it has gone far downhill.

    For one thing, the sample code is pretty crappily written, sadly outdated, and makes use of obsolete stuff like glaux.

    For another, the maintainer has moved on...Gamedev.net is (kinda) maintaining the site now, and not much is happening in the way of new tutorials.

  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