Title: OpenGL 4.0 Shading Language Cookbook Author: David Wolf Publisher: Packt Publishing Ltd. ISBN: 9781849514767 Pages: 340
Review submitted 29th November 2011
Before delving into the brave new world of OpenGL 4.0 fragment shaders, make sure that your graphics card can support them.
Supported Cards include: Nvidia GeForce 400, 500 series, ATI Radeon HD 5000, 6000 series
Essentially, this book is aimed at the intermediate to advanced C\C++ programmer, who also has experience with the implementation of fixed-function OpenGL applications, and who wishes to transition into the more direct GPU control-code, which shaders provide.
The book contains clear and concise examples of OpenGL code and it makes frequent reference to a couple of external libraries - GLEW and the GLM (mathematics library). The main IDE seems to be Nokia's Qt Creator, which is a strange choice, given that most professionals are probably using Visual Studio with GLUT.
If what I've just written makes no sense to you whatsoever, then this is not the book for you. It is very 'programmer-centric', covering not just the shaders, but how you bind and interface with them via your main application code. Although for artists like myself, who have a programming background, it is the ideal reference (or should I say recipe) book.
In chapter one, the author eases you into the subject by demonstrating how to create a basic OpenGL application with the additional libraries previously mentioned. I found this a bit tricky because I wasn't use to Qt Creator.
Chapter two introduces the reader to the fundamentals of the GLSL methodology, explaining the difference between vertex and fragment shaders and how they fit within the OpenGL pipeline. This section also refers to the basic shading algorithm of the old fixed-function model as a way of learning about the new shader-based model.
Subsequent chapters develop the simple application into more complex examples, covering topics like; Lighting and Shading Effects, Textures, Cube Mapping, Normal Maps, Screen Space Filters, Gaussian Blur, Bloom, Deferred Shading, Shadow Maps, Geometry and Tessellation Shaders.
Pros: 1. Clear and concise example code 2. Very detailed written explanations, including the original mathematics 3. The structure of the chapters eases you into the more advanced topics 4. Impressive coverage of virtually every topic in shader-based real-time rendering
Cons: 1. Programmer-centric (not for the pure video game artist) 2. Nokia's Qt Creator was probably not the best choice of IDE for the example code
I started reading this book last week. Here is what I have to say:
This is a great book. It splits the text into small manageable sections so the reader can "see" how much progress they are making more often. You won't fall asleep reading long sections or chapters that never end! It starts at the core subject of Shaders right from the beginning without wasting time. It is focused on OpenGL version 4.0 however it compares different versions as part of the text which I found very useful as I hadn't been keeping up to date with every latest OpenGL advancement since version 2.1 was published. It includes "simple" diagrams to visualise the theory and ideas without making things look over complicated. The advantage of this Cookbook also is that it gets you straight into practical programming recipes for the most important aspect of today's state of the art graphics programming, - Shaders; it does not waste your time on useless theories or math that you will never need. The book tells you a bit of what you need to know about the design aspects of OpenGL or its theory followed immediately by a "HOW TO DO IT..." section which includes "only the important parts of the code" relating to the section; it does not get the reader lost in 100's of lines of code that have nothing to do with the section - unlike some textbooks that include all the useless bits and only print the most important parts in bold or some that just tell you the math. The code is always explained in detail and it is not up to the reader to find out what a particular parameter means.
Besides the text, in my opinion this author is a real teacher. He knows all the different options, explains them to you, and does bother choosing the right one for his purposes by telling you why - he does not leave you confused if you have a bit of background in OpenGL. However he is very carful not get involved with what's not the focus of his book. It is like saying if you want to know more about that side topic this is not the time and place, please go find some other text and let us focus on what matters to us here.
For the first time I can update my knowledge by reading a single reference instead of using 4 different textbooks!
OpenGL 4.0 Shading Language Cookbook is one of the best modern OpenGL books I know. It has a vast content and all algorithms are explained carefully with source code. This book has a lot of interesting stuff for game developers.
I got a request from PACKT to review an OpenGL book they've published. It looked like a fun thing to do, so I said okay.
First off, this book is perfect for people who already know their way around OpenGL, but may not be too deep into shaders yet, and/or have some legacy bits in their engines.
The book does walk you through setting up a shader based application, and explains what kinds of support libraries you're going to need (always managing to pick the "other" lib than the ones I've used - they like glew more than glee, for instance - but the libs they picked still work as advertised, so I'm not saying they're bad choises. Oddly, there's no mention of SDL or SFML though), but knowing how OpenGL generally works as well as how the math generally works is taken for granted.
On the positive side you won't have to browse through hundred pages of basic matrix and vector math, or compilation basics, which I feel is a good thing.
After the basics the book gets to the fun stuff, explaining lighting, texture use, screen space trickery (like bloom and deferred shading), geometry shaders and tesselation, practical shadows (i.e, shadow mapping and PCT filters, but doesn't waste pages on anything "more advanced"), noise and some particle tricks.
All in all I think it's a rather good resource for anyone who wants to upgrade their OpenGL knowledge to more "modern OpenGL", dropping all legacy stuff, but it doesn't mean you don't still have to get your hands on the orange book.