Stories
Slash Boxes
Comments

News for nerds, stuff that matters

OpenGL Distilled

Posted by samzenpus on Wed Aug 30, 2006 02:19 PM
from the good-graphics dept.
Martin Ecker writes "Until now, if you were looking for an introduction to the OpenGL graphics API, the "OpenGL Programming Guide" (also known as the Red Book) was your best bet. Now Addison Wesley Publishing provides a new alternative that is easier to digest than the all-encompassing Red Book with its more than 800 pages. Paul Martz's "OpenGL Distilled" concentrates on discussing only the important fundamentals you need to program 3D graphics using OpenGL 2.0 and provides a concise introduction to the most important cross-platform graphics API currently available." Read the rest of Martin's review.
OpenGL Distilled
author Paul Martz
pages 266
publisher Addison-Wesley Publishing
rating 8/10
reviewer Martin Ecker
ISBN 0-321-33679-8
summary A concise introduction to the OpenGL graphics API


Before going into more detail and reviewing the chapters of the book I have to disclose that I was a technical reviewer of the book before it was published.

"OpenGL Distilled" is aimed at people interested in learning the basics of OpenGL. The reader should already be familiar with programming in C++ and have a basic grasp of linear algebra, in particular vector and matrix algebra. Familiarity with other 3D graphics APIs, such as Direct3D, is an advantage, but not a necessity. The book does a good job of presenting only the fundamental aspects of OpenGL and 3D graphics programming in general and never overwhelms the reader with too much unnecessary detail. The author draws a good line between what to discuss and what is beyond the scope of the book. More advanced features of the API are only mentioned shortly with appropriate references to more in-depth literature. Some deprecated features, such as the feedback buffer, that are no longer commonly used are left out as well. In my opinion an unfortunate omission, is shader programming with the OpenGL Shading Language, which is only briefly mentioned in an appendix. A full chapter introducing the basics would be a nice addition to the book. Until then the reader is referred to the Orange Book, which discusses shader programming in OpenGL in detail.

One thing I highly appreciate about "OpenGL Distilled" is the introductory section of each chapter, which contains a "What You'll Learn" and a "What You Won't Learn" bullet list. This makes it clear what the chapter is about and - more importantly - what it is not about. Especially the latter is mostly missing in other books.

The book has a total of 8 chapters and 4 appendices. The first chapter explains what OpenGL is, talks a bit about setting up a development environment on the most common operating systems to actually develop OpenGL programs, and immediately gets your feet wet with a first simple example program. The chapter is concluded by a whirlwind tour through the almost 15-year history of OpenGL and its predecessors.

Chapter two focuses on drawing primitives, such as lines and triangles, and the various ways supported by OpenGL to specify vertex data. In particular, vertex arrays and vertex buffer objects (VBOs), a fairly recent addition to OpenGL to allow high-performance rendering, are the focus of this chapter. Additionally, a first overview of the OpenGL pipeline that a primitive passes through until it finally ends up in the framebuffer is presented. A more detailed discussion of this pipeline, in particular with regard to coordinate transformations, follows in chapter three. The various coordinate systems used in OpenGL programming, such as object, world, eye, and clip coordinates, are presented and discussed in detail in this chapter.

Now that we can render primitives we need to light them to make them look more interesting. Chapter four sheds some light on this by discussing the lighting and material model used in OpenGL's fixed-function pipeline. The best part of this chapter is the section titled "Debugging Lights", which gives some insights and helpful advice on how to debug OpenGL programs that use lighting. Many other books only describe the features of OpenGL lighting but do not explain common debugging techniques that can be applied when all you get is a black window instead of a nicely lit scene.

Chapter five is about pixel rectangles, in particular how to read from and write to the framebuffer. Some performance considerations are also discussed, which is a good thing since reading from the framebuffer is a costly operation. Again, this chapter concludes with a nice section on debugging techniques. The explanation of the raster position in this section is probably the easiest to understand that I have read to date.

Chapter six is a comprehensive chapter on 2-dimensional texture mapping that also discusses some more advanced applications of the technique, such as light maps and depth maps. Also using cube maps as environment maps is introduced. 1-dimensional and 3-dimensional texture mapping was omitted from the discussion.

Chapter seven deals with detecting the feature set of the OpenGL implementation, in particular, determining the version of the OpenGL specification the implementation adheres to and the available extensions. This chapter also discusses how to retrieve and use entry points for available extensions.

Finally, chapter eight deals with the platform-specific interfaces required to hook up an OpenGL program with the underlying operation system. These platform-specific interfaces are called GLX for Unix, WGL for Windows, and AGL for Mac.

The book has four appendices, which deal with a quick overview of advanced features, best practices, performance-related issues and debugging tips and tricks. Especially the latter two appendices on performance and debugging contain a lot of insights invaluable to programmers just starting out with OpenGL.

The book is printed in black and white throughout. Having some color plates in the book itself would have been a welcome addition considering that the topic is computer graphics. However, you can download some color plates from the books website at where you will also find the source code to the example programs in the book.

In conclusion, "OpenGL Distilled" is an excellent introduction to OpenGL, not only for someone new to 3D graphics programming but also for those that have worked with other 3D graphics APIs in the past that wish to get up to speed with OpenGL quickly. The book omits advanced and deprecated features that would unnecessarily overwhelm a beginner with OpenGL and is a good companion on the way to becoming an experienced OpenGL programmer.

The review author has been involved in real-time graphics programming for more than 10 years and works as a games developer for arcade games. In his rare spare time he works on a graphics-related open source project called XEngine http://xengine.sourceforge.net./


You can purchase OpenGL Distilled from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

Related Stories

[+] OpenGL Shading Language 96 comments
Martin Ecker writes "A few months ago, the OpenGL Shading Language -- OpenGL's own high-level shading language for programming Graphics Processing Units (GPUs) -- was ratified by the Architectural Review Board (ARB) responsible for the development and extension of the OpenGL graphics API. The first real-world implementations are just becoming available in the latest graphics drivers of the big graphics hardware vendors. Now the first book that features this new shading language is available, with the intention of becoming the standard book on the subject. Randi J. Rost's OpenGL Shading Language (published by Addison-Wesley) is a good introduction to developing shaders with the new OpenGL Shading Language, and demonstrates a number of useful applications for real-time programmable shaders." Read on for the rest of Ecker's review.
[+] OpenGL Programming Guide 143 comments
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.
This discussion has been archived. No new comments can be posted.
Display Options Threshold:
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • I like this book (Score:3, Informative)

    by 2.7182 (819680) on Wednesday August 30 2006, @02:21PM (#16009807)
    My only complaint is that the binding broke in a couple of weeks, and I had lost the receipt. So hold onto it.
  • by Anonymous Coward on Wednesday August 30 2006, @02:41PM (#16009973)
    This is the sort of book that may become quite useful in the future. Over at OSNews there have been some rumors that the AMD/ATI combo will be releasing a high-quality OpenGL 2.0 implementation to take advantage of the many OpenGL-related advancements there have been for X recently. Supposedly they want to be at the cutting edge of technologies like Xgl, Compiz, glitz and so on.

    I really don't know if this is idle speculation or there is some basis to it, but it is something interesting to consider. Perhaps nVidia should step up and release an OpenGL 2.0 implementation before AMD/ATI manages to. Last I checked, the implementation provided with the nVidia drivers for Linux was for OpenGL 1.4.

  • A reasonable overview of OpenGL (Score:5, Informative)

    by kafka47 (801886) on Wednesday August 30 2006, @02:44PM (#16009994)
    (http://covertcreations.com/)

    I'm reading this right now, and it is substantive and helpful. The downside is that it can get rather terse at times, without as much explanation as I felt was deserved. I suppose that's why they called it, "distilled". :)

    Anyhow, the bulk of the book is not for the faint of heart. Be dialled when you read this, you're not getting any hand-holding.

    It's interesting the review above was written by one of the technical reviewers of the book, the result being more of an overview than a pure objective review (with positives, negatives). Or maybe I'm asking too much.

    /K

  • hmmm... (Score:2)

    by rice_burners_suck (243660) on Wednesday August 30 2006, @02:49PM (#16010024)
    (Last Journal: Sunday November 04, @03:38AM)
    This sounds like an interesting book to read over coffee or something. But does it cover that weird thing where the RGB values are 16-bit in some places and 24-bit in others? That really confused me in the past.
  • picking (Score:2, Interesting)

    by stinkytoe (955163) on Wednesday August 30 2006, @03:40PM (#16010470)
    Some deprecated features, such as the feedback buffer, that are no longer commonly used are left out as well.
    Just out of curiosity, how is picking usually done nowadays, if not with the feedback buffer? Geometrically (i.e. outside of the OpenGL Machine)? Or does OpenGL provide another tool for picking?
    • Re:picking (Score:4, Interesting)

      by Intron (870560) on Wednesday August 30 2006, @03:52PM (#16010596)
      Use selection mode instead of feedback mode and render at the coordinates. The hit records will indicate the rendered objects and their depths.
      [ Parent ]
    • Re:picking by robertchin (Score:2) Thursday August 31 2006, @11:10AM
    • Re:picking by forkazoo (Score:2) Thursday August 31 2006, @12:53PM
    • Re:picking by Cutting_Crew (Score:2) Saturday September 02 2006, @03:45AM
  • by peterpi (585134) on Wednesday August 30 2006, @03:56PM (#16010648)
    I'm in the market for a new computer, and I'm going to be writing games for it.

    What's the deal with developing with OpenGL on linux at the moment? Last time I tried (2002 maybe?), there was something called Mesa, another thing called DRI or some such, another thing called GLX. It all got a bit confusing. I ended up using cygwin for a bit, then finding something else to do.

    Is it the case now that I can just 'apt-get install opengl-devel' and have stuff just work?
  • That's odd (Score:4, Funny)

    by o-hayo (700478) <andy AT lbox DOT org> on Wednesday August 30 2006, @04:41PM (#16011051)
    If movies taught me anything its that The Red Book is NSA Trusted Networks and doesn't fit on shelves.
  • Win32? (Score:1)

    by Swordless Samurai (982348) on Wednesday August 30 2006, @06:21PM (#16011781)
    (Last Journal: Thursday September 07 2006, @02:45PM)
    I like OpenGL, but my one problems is the lack of ease it gives for Win32 Programmers. I know it is cross-platform, but to program a opengl app in linux and win32 are totally different, so what's the point in developing a OpenGL app if the audience you intent on targeting is small(I.E. Linux)? Why not just setup for MS's DirectX which will obviousally win your apps much more support.
    • Re:Win32? by Anonymous Coward (Score:2) Wednesday August 30 2006, @08:06PM
      • MOD PARENT UP by remembertomorrow (Score:2) Wednesday August 30 2006, @09:40PM
    • Re:Win32? by babbling (Score:2) Wednesday August 30 2006, @08:09PM
      • Re:Win32? by TrancePhreak (Score:2) Thursday August 31 2006, @12:05AM
        • Re:Win32? by babbling (Score:3) Thursday August 31 2006, @04:12AM
    • Re:Win32? by sowth (Score:1) Wednesday August 30 2006, @08:45PM
    • Re:Win32? by Fartacus (Score:2) Thursday August 31 2006, @07:30AM
  • by toybuilder (161045) on Wednesday August 30 2006, @07:23PM (#16012132)
    How well does the book cover the subject of stereoscopic 3D?
    BTW, for anyone reading this -- does anyone know how to get Google Earth to do stereoscopic 3D?
  • Buy this book! Support Paul! (Score:4, Interesting)

    by XenonOfArcticus (53312) on Wednesday August 30 2006, @11:18PM (#16013223)
    (http://www.arcticus.com/)
    Full disclosure: Paul is a friend of mine, and I helped proof this book too.

    In all seriousness, this is an excellent book. Paul wrote this book to fill a serious need -- an updated, quality OpenGL book for this age. So much of what is in the canonical texts is no longer important (geometry by Begin/End), and they won't cover the new recommended practices (VBOs, Vertex Arrays, etc).

    On a personal level, Paul is one of the most generous and helpful programmers I know. I owe him lots of beer for all the advice he has provided. He also participates in the open source OpenScenGraph project:
    http://openscenegraph.org/ [openscenegraph.org]
    a high-performance 3D toolkit for Windows, Mac and Unix/Linux, used in hundreds of open source and commercial simulator, game and 3D visualization projects (including my company's NatureView Express tool http://3dnature.com/nv.html [3dnature.com] -- plug plug!)
  • Re:How much waste? (Score:1)

    by October_30th (531777) on Wednesday August 30 2006, @02:37PM (#16009938)
    (http://finnbiff.multiply.com/ | Last Journal: Saturday May 12 2007, @10:04AM)
    Some of us hate reading stuff on the screen. It's starting to piss me off that some hardware manufacturers are just supplying pdf versions of their catalogs or manuals and they expect me to print them out.
    [ Parent ]
  • by Dopeskills (636230) on Wednesday August 30 2006, @02:58PM (#16010086)
    Quake/Doom , Unreal Tournament, etc... use OpenGL. Many workstation apps use it too.
    [ Parent ]
  • Re:MOD PARENT UP (Score:2)

    by sholden (12227) on Wednesday August 30 2006, @03:02PM (#16010127)
    (http://sam.holden.id.au/)
    Because $34.99 isn't cheaper than $34.99?

    [ Parent ]
    • 1 reply beneath your current threshold.
  • Re:If only... (Score:3, Informative)

    by Doggan (945328) on Wednesday August 30 2006, @03:17PM (#16010251)
    (http://shy.am/)
    Stop spreading these myths about OpenGL not being supported on Vista. OpenGL is will remain alive and well [dailytech.com] for Vista.
    [ Parent ]
    • 1 reply beneath your current threshold.
  • by Anonymous Coward on Wednesday August 30 2006, @03:20PM (#16010276)
    It's true, most users of OpenGL today aren't game developers. We're doing far more serious and practical work. What we're talking about here are medical imaging, military simulations, petroleum exploration, and advanced CAD design.

    OpenGL likely powers the design tools that were used to develop many of the components in your computer, your vehicle, your cell phone, and your television. OpenGL is used by the simulation software your father's doctor uses to track the spread of your father's penile cancer. OpenGL is used in the process of locating the oil which becomes the gas you pour into your car.

    OpenGL is used all around you. You're mostly just oblivious to it, since your world doesn't extend outside of Halo 2.

    [ Parent ]
  • by rmdir -r * (716956) <<evilchocolate> <at> <bonbon.net>> on Wednesday August 30 2006, @04:57PM (#16011179)
    Obviously Unreal Tournament, the Quake/Doom series, Warcraft III, and that obscure game known as 'World of Warcraft' don't use OpenGL. Unpopular games like Half-Life/Counterstrike don't use OpenGL. There are no games for the Gamecube, and there will be no games for the Wii or the PS3.

    And obviously all serious visualization work isn't done in OpenGL.

    Go back to your cave, troll.
    [ Parent ]
  • Re:Speaking as a software engineer (Score:3, Interesting)

    by uchian (454825) on Wednesday August 30 2006, @06:50PM (#16011946)
    (http://www.uchian.pwp.blueyonder.co.uk/)
    Direct X is not cross platform, so is not an option for us, but Direct X is very heavy in areas that openGL is very light (in openGL, the limitation on drawing geometries is much less than the Draw index Primitives (DIP's) in directX, although state changes are heavy.

    Overall, the openGL interface is much simpler to optimize than directX. That is from my experience of both (althoguh I admit my experience of optimizing direct X is much less than that of openGL), in both cases batching is incredibly important, in openGl what is going on is very transparent.

    But coming from the simplicity of openGL, it has to be said the over-complicated COM interface of Direct X is hideous...
    [ Parent ]
  • The Really Slick Screensaver collection. Blender. Jahshaka. Quake (all versions). Doom 3. Warcraft III/World of. Halflife / Counterstrike. The GameCube. The Wii. (supposedly,) the PS3. Bryce 3d. Anything by Silicon Graphics. Bindings for every language on every platform under and out of reach of the sun.

    Yeah. Completely unpopular. Please do me a favor and remove your lips from Mr. Ballmer's rear end long enough to post coherently when on Slashdot.
    [ Parent ]
  • by DangerAwaits (858229) on Thursday August 31 2006, @09:09AM (#16015513)
    I'm currently reading this book also. I'm not so crazy about it. I have a good understanding of computer graphics, but no knowledge of OpenGL. It seems like its trying to be all things to all people, and delivers to noone. Here's an example from page 6, talking about fragments: "OpenGL implementations that support multisampling, however, store fragments in subpixel locations." And then we move on to Rasterization. What is multisampling and subpixel location storage? How do I know if my implementation supports it? Why was it important for the author to state this? If I'm already supposed to know these details, then why should I get this book? Why not just use a reference?
    [ Parent ]
  • Re:How much waste? (Score:1)

    by SkewMatrix (999164) on Thursday August 31 2006, @11:08AM (#16016463)
    I'm the author of this book. It's hard to please everyone... An early technical review comment stated that "you should include complete source, mere snippets aren't very helpful". I disagreed with this, especially since conciseness was critical. If you read the full book, you'll see that snippets are the primary mode for examples. Did I use full source in a few places? Yes, guilty as charged, and required given that not everyone will have access to the example code. However, I'm constantly looking for ways to reduce the page count in future revisions, so I'll consider removing some of the source. This might make room for things like FBOs or an expanded GLSL section. No apologies for the chapter 1 material -- this is a beginner's book.
    [ Parent ]
    • 1 reply beneath your current threshold.
  • 11 replies beneath your current threshold.