1 of 1 people found the following review helpful
Adequate, but not the book I was hoping for.,
Verified Purchase(What is this?)
This review is from: OpenGL Shading Language (3rd Edition) (Kindle Edition)
I have many years of programming experience with OpenGL, and I needed to explore "shaders" (programming the GPU) using OpenGL Shading Language (GLSL), so I bought this book as a companion to my copy of the "Red book" OpenGL Programming Guide: The Official Guide to Learning OpenGL, Versions 3.0 and 3.1 on OpenGL. I'm probably just stupid, but I found it very hard to work out how to use GLSL from this book.
"Shaders" refer to three separate programmes you can run on the GPU: "vertex shaders" which programme per-vertex information, "geometry shaders" which allow optional access to primitive points, lines and triangles, and "fragment shaders" which deal with the rendering of individual pixels. If you choose to write these you generate small programmes which replace certain bits of the built-in graphics pipeline, the aim being to give the programmer much more flexibility and to permit pretty much anything to be done to the graphics data.
So shaders are a bit like islands of accessibility to graphics data in a sea of hidden architecture on the GPU. Certain bits of data are "built-in", and certain graphics processes are also fixed and hidden away from the programmer, and I found it very hard to determine from this book alone exactly what fell into which category, and how I should interface with the built-in graphics processing. To pursue my maritime analogy: if graphics data is like freight sent by shipping, then you intercept cargos en-route, fiddle with them a bit, then send them on. But to do this you need to fit into the shipping schedules, know what freight is on the boat, know what you are and are not allowed to change, how you should load it, and so on.
I found this book very weak on explaining data flow (shipping schedules in my analogy), and also how the data (the cargo) is organised . Without this information you are a bit stuffed! A diagram showing this and listing all the "built-in" variables available at each stage (with their attributes) would have been a priceless help. Fortunately a lot of information about GLSL is available online, and that is just as well because I don't think this book alone would have given me enough information to get the job done.
Once I'd figured out the missing bits and pieces the second half of this book, which is mainly worked examples of how to achieve effects with shaders, proved very useful as a source of ideas. In particular chapter 9, Emulating OPenGL Fixed Functionality, is crucial for a novice at GLSL because you have to start at the beginning with basic transformations, colour, shading and lighting and this shows you how to do it.
In conclusion I'd say that you can learn GLSL from scratch using this book, but you'll also need a web browser in order to answer all the questions it fails to answer. Once you've got going it makes a reasonable reference guide, and the coded examples in the second half are particularly worthwhile. But I do wish the authors had studied Kernighan and Ritchie's The C Programming Language (2nd Edition), in my view the best book ever written on a computer language: clear, concise and well organised ... which this book definitely is not!