Slashdot Mirror


OpenGL SuperBible 5th ed.

asgard4 writes "OpenGL SuperBible in its fifth edition is almost a complete rewrite. The authors threw out the discussion of old-style, fixed-function programming and replaced it with an introduction to OpenGL that is exclusively focused on using shaders from the very beginning. All the things that got deprecated with the advent of OpenGL 3 got removed, making it a more relevant and up-to-date book than the previous editions. The OpenGL SuperBible still strives to be the 'world's best introduction to OpenGL' according to the authors. Let's see if it can keep that promise." Read on for the rest of Martin's review. OpenGL SuperBible (Fifth Edition) author Richard S. Wright, Jr., Nicholas Haemel, Graham Sellers, Benjamin Lipchak pages 969 publisher Addison-Wesley Publishing http://www.awl.com rating 9/10 reviewer Martin Ecker ISBN 0-32-171261-7 summary : Quite possibly the best introduction to OpenGL 3.3 programming that focuses exclusively on graphics programming using shaders With the removal of the fixed-function pipeline, the OpenGL SuperBible is no longer quite the heavy-weight it used to be. It shrunk from more than 1200 to about 970 pages, which is not necessarily a bad thing. The book starts out with a basic introduction to 3D graphics, coordinate systems, and some basic math concepts, followed by short rundown of the history of OpenGL and a first little example program that renders a triangle. The authors even provide instructions on how to setup the C/C++ projects to build the example on Windows and MacOS. The writing is to the point but still verbose enough to easily follow the text. The authors analyze the example program in detail making it easy for a beginner to follow and understand the code. Overall, I really like the writing style and the flow of the book.

The next few chapters gradually introduce more and more OpenGL API functionality intermixed with new 3D graphics concepts, such as rendering points, lines, and polygons in various ways, alpha blending, how to use geometric transformations and projections, and how to move objects and the camera. Eventually, basic texture mapping is introduced with most of the basic things you need to know about the topic. In particular, specifying textures coordinates, sampling textures in the fragment shader, the various filtering modes (even anisotropic filtering), and texture compression are discussed. In a later chapter the authors do another deep dive into the topic of textures, in particular rectangle textures, cube maps, multitexturing, point sprites, and using texture arrays

Until this point the authors used haven't really talked much about shader programming yet. Most of the examples use simple pre-made shaders that don't really do much. This changes with chapter six titled "Nonstock Shaders" where we get a first glimpse of how to write our own shaders in GLSL, the OpenGL Shading Language. In particular, a fragment shader that uses a simple lighting model to light objects is developed.

After these introductory chapters presenting the basics of OpenGL programming, the next part of the book focuses on more advanced topics, beginning with buffer objects and how to use them to make your OpenGL programs run much more efficiently on modern hardware. Some of the examples presented in this part of the book include using render-to-texture to do reflections, tone mapping, and bloom. This part of the book closes with two fairly long chapters on advanced usage of the shader pipeline, in particular the transform feedback and the geometry shader stages. There is also some discussion on more advanced effects achievable with fragment shaders, in particular applying filters to images, such as a Gaussian blur or a Sobel filter. Finally, rendering geometry efficiently with vertex buffer objects and rendering many objects via geometry instancing is presented.

The final part of the book consists of 4 chapters explaining how to integrate OpenGL with the underlying operating system, in particular with Windows, Mac OS X, and Linux plus various other Unix flavors. The last chapter of this part of the book is about OpenGL ES, which is a version of OpenGL designed to be used especially on embedded system devices, in particular mobile phones and PDAs, to render real-time, interactive 3D graphics.

The book has a lot of images and diagrams throughout, though unfortunately not all of them are in color. There are however 24 color plates of the most interesting images in the middle of the book. The complete source code of the book, and even precompiled binaries for Windows and Mac OS X, can be downloaded from the book's webpage.

If you are new to both 3D graphics programming and OpenGL with a bit of C/C++ programming experience and you are eager to learn how to develop interactive programs with OpenGL, then this book is exactly right for you. The book is written in an easy to understand style without skimming the details (or even more advanced topics). It is the most comprehensive introduction to OpenGL that doesn't require a lot of previous knowledge I have seen to date. The decision to completely drop any discussion of the fixed-function pipeline turned out to be an excellent choice. Finally there is a book that no longer wastes the reader's time with the parts of OpenGL that nobody who does serious graphics development uses and instead presents up-to-date information on how to do 3D graphics on modern graphics hardware.

All in all, the OpenGL SuperBible in its fifth edition succeeds very well in keeping its promise to be the best introduction to OpenGL and 3D graphics programming. Even after you're done working your way through the main parts of the book you will always come back to the handy OpenGL API reference in the appendix of the book.

The review author has been involved in real-time graphics programming for more than 10 years and works as a professional game developer for High Moon Studios in sunny California.

You can purchase OpenGL SuperBible (Fifth Edition) from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

21 of 98 comments (clear)

  1. Imagine by Reilaos · · Score: 3, Funny

    Just try to imagine, for a moment, my disappointment when I realized this was not an open source 3d rendering of a comic-book version of Jesus SuperChrist.

  2. Re:How about non-Windows and non-Mac? by WilyCoder · · Score: 3, Informative

    You're thinking of OpenGL ES. Theres a good book for that already.

  3. Re:How about non-Windows and non-Mac? by 91degrees · · Score: 2, Informative

    Consoles tend to use their own APIs. The one on the PSP has a resemblance to OpenGL but it's quite different. Not sure about the others.

    Smartphones use OpenGL ES. This is basically a subset of OpenGL. The OpenGL bibles don't usually include specific information on these. They're aimed more at desktop applications.

  4. Re:How about non-Windows and non-Mac? by SplashMyBandit · · Score: 5, Informative

    The last OpenGL SuperBible touched on OpenGL ES (the stuff Android phones, iPod/iPad/iPhone etc). OpenGL ES is a subset of the full OpenGL functionality so this book is a good start to both. You can also get an Addison-Wesley book on OpenGL ES as well but the SuperBible is still worth it for the techniques it teaches (how to best use the API and but stuff together for various effects).

    I hope all you DirectX programmers take note. Those who wrote for DirectX might have been able to make money on the PC+XBox but the software doesn't move to the PS3, iPhone/iPad, Android, Linux (while still running on Windows too) like OpenGL does. You all fell for Microsoft's deliberate plan to keep you on that platform (where is the Slashdot "it's a trap" tag when you need it, lol). You never know exactly what the future will bring but you do know that devices and operating systems will change. This makes OpenGL the best strategic (long-term) choice for 3D development and the OpenGL SuperBible is a great book to get you there (along with the other OpenGL classics: the 'Red Book', 'Blue Book' and 'Orange Book' - google for these or go to the OpenGL site: http://www.opengl.org./

    Case studies:
    The author of X-Plane talks about OpenGL made him $3.5 million in a month since he could port his product to iPhone very easily. He'll make even more money from iPad sales too (my nephew just bought X-Plane for the iPad):
    http://techhaze.com/2010/03/interview-with-x-plane-creator-austin-meyer/

    Il-2 Sturmovik had both a DirectX and (faster) OpenGL implementation. Coupled with the fact that it is largely written in Java and it was able to be ported to the PS3 as the product Wings-of-Prey greatly increasing sales.

    If you must learn a 3D library, then learn OpenGL.It has the features of DirectX 11 (geometry shaders etc) but will run on Windows XP.

  5. Re:How about non-Windows and non-Mac? by Daniel+Phillips · · Score: 3, Insightful

    Also, ES like 3.0+ does all everything with vertex arrays and not immediate mode. (Immediate mode is still available in 3.0+, though deprecated, however it was completely removed from ES.) The biggest difference between ES and mainstream OGL is the central role of 16:16 fixed point, which to be honest is not very much different from FP, you just need to pay more attention to expression precision.

    --
    Have you got your LWN subscription yet?
  6. Re:OpenGL - do they still have that? by Mysteray · · Score: 3, Informative

    OP may or may not be intentionally trolling, but the question is pretty easy to answer:

    Yes.

    Just about every program that does 3D graphics on anything besides MS Windows or XBox uses OpenGL, today.

  7. I have to buy another one? by t1oracle · · Score: 3, Funny

    I haven't even started reading the old one.

  8. Re:How about non-Windows and non-Mac? by Anonymous Coward · · Score: 2, Informative

    Fixed point has its limits with precision. It's not a brilliant scheme to be working with when it comes to 3d graphics. Most vendors have realised this, and any mobile GPU from since a few years before the iphone was introduced will have full floating point support, shaders and modern concepts available.

    Fixed point is an option in OpenGL ES 1.1 (common-lite version). There is also a better version of OpenGL ES 1.1 which is fully floating point. Then there is OpenGL ES 2.0, which offer full shader support and has everything you absolutely need to make pretty much anything. The next generation of OpenGL ES coming up next year will be based on OpenGL 3.x, cutting away all the deprecated stuff, the fluff and other useless extensions. But really, OpenGL ES and OpenGL are converging. GLES are adopting features from GL, and GL are deprecating stuff not found in GLES.

  9. Re:OpenGL - do they still have that? by nschubach · · Score: 3, Informative

    Are we talking console(OpenGL ES)? Pretty much all of them.

    Are we talking PC (OpenGL "proper")? Isn't Valve's Source Engine OpenGL capable now?

    --
    Every time I start to have faith in humanity, I ruin it by driving to work between 7 and 8 am.
  10. Re:How about non-Windows and non-Mac? by SplashMyBandit · · Score: 3, Interesting

    > 1) Don't be so snide.

    I'm just fed arguing with the "3D means DirectX games on Windows only" crowd. with Apple's ascent it is time for them to eat crow since their point-of-view was as sensible as the web-development "target IE6 only and forget about W3C compat" crowd (which was a battle we had to fight in the enterprise space as many "ohh, shiny" operations people have short-term horizons). This snideness is vindication and not intended to insult the sensitive, so please don't take it personally.

    > 2) It's really not that hard to port a DirectX game to PS3 (I won't say OpenGL, since most PS3 games don't use OpenGL.) Dozens of games have already done that, including DirectX-supporting companies like Valve.

    Huh? The official graphics API for the PS3 at the lowest level is OpenGL. Of course ports can be done. It simply takes more time (eg. money) if you start with DirectX instead of OpenGL ... and you should be thinking about the long-term *money* if you are a half-decent architect.

    > 3) In the gaming world, you only care about the game working for its sale period, which is maybe two years at best. Trying to sell game developers on long-term technology are a waste of time.

    Nope, you need to look at the whole equation. The tools and experience of the developers really counts. A single game sales might be two years tops but the tech a studio chooses (investing time and developer experience in) has to last a lot longer than that somce they don't like to change their technology often. Changing tech costs significant money and time. This is why the DirectX-only shops will have a period of inefficiency while they retooling for iPad etc). Fortunately many shops use professional frameworks which hide most of the underlying DirectX-ness or OpenGL-ness from the developer, which allows them to target multiple platforms.

    All I'm saying is OpenGL is a good tech to investigate that has *lots* of strategic benefits compared to its closest competitor (for those still mezmerized by the now-waning DirectX hype).

  11. Re:OpenGL - do they still have that? by pnewhook · · Score: 2, Interesting

    For graphics quality and capability, there really isn't that much difference between OpenGL and DirectX. They have the same feature set and the same rendering ability. The only difference is that DirectX uses this ridiculous counterintuitive left and rule for polygons. OpenGL uses right hand rule which is the way Engineering and God intended.

    Other than that, OpenGL is the only real open standard for graphics. DirectX is only on Windows. OpenGL is on Windows and most other platforms.

    Also OpenGL is the only solution if you want to generate your own 3D stereoscopic scenes. DirectX does it for you in the driver but this is just a cheap approximation. If you want accurate, non-eye fatiguing stereo, then OpenGL is the only solution.

    --
    Tesla was a genius. Edison however was a overrated hack who liked to torture puppies.
  12. Re:How about non-Windows and non-Mac? by pnewhook · · Score: 2, Interesting

    Game Development with OpenGL consumes significantly more time than equivalent development in DirectX

    Can you elaborate? I'm curious as to why you would say that. In my experience OpenGL is far easier to understand and write than DirectX.

    --
    Tesla was a genius. Edison however was a overrated hack who liked to torture puppies.
  13. Re:3D Bible by Anonymous Coward · · Score: 5, Funny

    1:1 - In the beginning God created the heaven and the earth.

    1:2 - And the earth was without form, and void; and darkness was upon the face of the deep. And the Spirit of God moved upon the face of the waters.

    1:3 - And God typed,

    glEnable(GL_LIGHTING);

    ...but there was no light, for GL_LIGHTING is deprecated in OpenGL 3.0, and even in 2.0 there's like five other settings that He would have had to enable to get anything to display.

    1:4 - And God went back to the NeHe tutorial, and it was good, but somewhat out-of-date.

  14. OpenGL 4.1 is out by neuro88 · · Score: 2, Informative

    This looks like a good book, but it covers OpenGL 3.3. Can someone provide a high-level overview of the differences between OpenGL 3.3 and 4.1?

    1. Re:OpenGL 4.1 is out by Narishma · · Score: 2, Informative

      OpenGL 3.3 is basically a backport of a bunch of stuff from OpenGL 4.1 that they could make work on DX10 level hardware (OpenGL 4.1 needs DX11 level hardware).

      --
      Mada mada dane.
  15. Re:How about non-Windows and non-Mac? by pnewhook · · Score: 2, Insightful

    This is mostly due to the extra debugging and analysis support that they have in the DirectX SDK.

    Not available if you want cross platform. There are a lot of OpenGL debug tools as well.

    OpenGL can be fast for getting something together pretty quick, but then figuring out why it doesn't work the same way on other systems can be very troublesome.

    Well DirectX has solved this one by not having any other systems. It's Windows or nothing.

    In my experience, I have also seen people who use OpenGL redoing things that DirectX has done for you in the past, such as reference counting.

    Why should a graphics system handle a programmers reference counting? This gets into your coding strategy. Handle it the same way you handle access to any other shared resource like a memory or device handle.

    --
    Tesla was a genius. Edison however was a overrated hack who liked to torture puppies.
  16. Re:Bible? WTF by e4g4 · · Score: 3, Funny

    But "bible" is a completely appropriate term in this case. It tells you a great many details about something that was completely fabricated by humans.

    --
    The secret to creativity is knowing how to hide your sources. - Albert Einstein
  17. Re:How about non-Windows and non-Mac? by Barefoot+Monkey · · Score: 2, Insightful

    Fixed point has its limits with precision. It's not a brilliant scheme to be working with when it comes to 3d graphics. Most vendors have realised this, and any mobile GPU from since a few years before the iphone was introduced will have full floating point support, shaders and modern concepts available.

    Actually, floating point has limits to its precision too. A 32-bit floating point number has a 23-digit significand, whereas 16:16 fixed point has a 32-digit significand, so fixed point is 128 times as precise as floating point. The main benefit of fixed point, however, is reliability; unlike floating point, your numbers don't become less accurate as you move away from the origin. The drawback of fixed point is range; unlike floating point, fixed point cannot sacrifice accuracy to allow for larger numbers, so the biggest number you can store is slightly less than 32768. That is enough to represent a 320x320 kilometer area with an consistant accuracy of ~1.5 millimeters, which makes fixed point attractive format for data representation. On the other hand, floating point would been fine near the middle, but have been accurate to only 0.8 meters near the edge, and you'd probably end up having to shrink the area to down to 4x4 kilometers to avoid problems.

    I agree with you that a device with only floating point and integer support is far superior to one with only fixed and integer, but fixed point is indeed very good to have in 3D graphics for those situations where it is more appropriate.

  18. Re:OpenGL - do they still have that? by TrancePhreak · · Score: 2, Insightful

    So you say there's no left hand coordinate system, then say D3D uses one... Then you post a link that says it can be either.

    --

    -]Phreak Out[-
  19. This book is for OpenGL 3 - does not work with OSX by Sludge · · Score: 4, Informative

    Apple only supports OpenGL 2.1 (plus extensions). The Fifth Edition of the book only covers OpenGL 3. GLSL has changed a great deal since 2.1 and this book is very incompatible with any released version of OS X as of this writing.

    If you want to write OpenGL that is compatible with a Mac, get the Fourth Edition of the book.

  20. Re:OpenGL - do they still have that? by pnewhook · · Score: 3, Informative

    Why is this so hard to understand?

    There is NO left hand coordinate system in the REAL world. All of physics, engineering, robotics and most graphics use a right hand coordinate system. Obviously you can define a coordinate system to be anything you like, and DirectX has defined theirs to be left handed which is contrary to every other standard out there.

    The link does not say it can be either. It says DirectX uses a left hand coordinate system. They then tell you how to use right hand coordinate DATA but fundamentally the internals are still left handed.

    Does that explain it for you?

    --
    Tesla was a genius. Edison however was a overrated hack who liked to torture puppies.