View Full Version : GLSL Essentials - a short book review

06-07-2014, 06:05 AM
As I've announced, I’ll tried to shed some light on the OpenGL books' scene.

Since there is no special sections for the books, tutorials and other OpenGL related assets (which may be an interesting section for opening on the forum), I'll post this (the first one) in the GLSL section, since the book is quite GLSL specialized.

This post will be devoted to GLSL Essentials, written by Jakobo Rodriguez, and published by Packt Publishing. The first impression is imposed by the shortness of the book. Just about 90 pages of topic related text including code and images. This shortness combined with the title “Essentials” sounds like an ideal solution for beginners. Unfortunately it is not for several reasons.

First, there isn't an example of loading, compiling or linking shaders, getting errors, etc. There are examples how to interact with the host application, but very poorly described without even intent to describe VBOs, VAOs, purpose of binding, or anything else important to communicate with shaders. Maybe because author really means GLSL is an entity per se (what is explicitly said in a text), that relays on OpenGL just to compile and execute shaders.

Second, it is obvious that the author is not an educator. Many terms are used without been defined previously. For example: "The geometry shader stage happens after the primitive assembly stage." The primitive assembly is not defined anywhere in the book. There are some images depicting the pipeline, but there is no the primitive assembly stage.

Third, there is no source code or any other resources accompanying the book. Maybe beginners would easily digest some topics if they could download the source and try to execute. Of course, some experienced programmers could manage to compile the code and download any texture to represent the butterfly, for example, to accomplish the geometry shader chapter's tutorial, but newcomers couldn't.

The good aspect of the book for the beginners is that it doesn't dive deep into the matter. When the things become complicated...ups there's the end of the chapter. :) Nice, indeed.

Also, maybe they would appreciate informal style of writing, but it really bothers me. As well as some serious errors the writer trapped into trying to simplify the story. For example, several sections start in a poor presenters manner: "OK, ...". "Ok, at this point we have some useful variable types...". "OK, now that we have our geometry correctly rendered..." Some serious errors are: "As GLSL relies on OpenGL, you must use OpenGL to compile and execute the shader." – GLSL is a part of OpenGL. "Consider a triangle; in order to paint that triangle onto the screen you need to convert it from its native vectorial form (vertices coordinate) to discrete pixels. The system that carries out that action is the fragment shader module, being executed once per each fragment." – Rasterization is the process of converting geometrical primitives to fragments. Fragment shader does not rasterize primitives. And how can if it operates on a single fragment. Don't worry, the author knows exactly what's happening, but does a naive reader know?

It is a pity to write a book about GLSL 4.3 and not explaining tessellation shaders. This book mentions them just once, at the page 12, telling us that they are used "to subdivide triangle meshes on the fly, but we are not covering them in this book". Great!

At the end I'll recommend reading the book for a single afternoon. The reading is very easy. But if you are an absolute beginner without ever tried to execute GLSL code, this wouldn't be an easy start. Also, the books swim in very shallow water without trying to explain anything in depth, and there are some serious errors in statements preventing it to be a reference. But it is a nice light and friendly (informal) reading. Like talking to a colleague that wants to prepare you for an exam by just throwing at you the material you should know. He doesn't have bad intents; just don't have the time to spend (hours) on you. :)

06-08-2014, 06:49 AM
Thank you very much. Bookmarked.