PDA

View Full Version : Question about books



RoiiG
11-03-2010, 11:30 AM
I want to learn how shaders work, and I found various books:

- OpenGL Shading Language (3rd Edition)

- OpenGL SuperBible: Comprehensive Tutorial and Reference (fifth edition)

Another book? If not, which will you buy ? I can't afford buying both. Maybe Opengl Shading Language (third edition) is a bit outdated? I can't find it on amazon.co.uk .

Thanks :)

Aleksandar
11-03-2010, 01:17 PM
The answer heavily depends on your OpenGL knowledge level.
If you don't know at least how to use VBOs, and how to "bind" shaders and the application, Orange Book (aka OpenGL Shading Language) could cause a bit of frustration. I hope I won't be misunderstood, the book is great, but the samples from the book the beginners cannot use "out of the box". The code samples are also missing. The code on the site is for the previous release of the book.

I think that the Superbible is not focused on the shaders only, but rather on OpenGL itself on very specific way. Superbible introduces its own object model, and a large amount of text is dedicated to pretty basic stuff. On the other hand, there is a subsection about geometry shaders that is missed in the Orange Book (because GS are introduced in GL 3.2, and OB covers just 3.0).

Both books are outdated. In the moment when OpenGL Shading Language 3rd edition was out, OpenGL 3.2 was already on the scene. OpenGL Superbible 5th Ed. covers GL 3.3 and came out after GL 4.1 was released. GL is developing so rapidly that the books cannot support it appropriately.

If you are new to OpenGL I'll suggest you Superbible, but if you intent to focus only on GLSL, then maybe Orange Book will be better solution. But it is up to you. :)

P.S. As I already said in some of the previous posts, OpenGL ES 2.0 Programming Guide is maybe the best book to start with. Some principles are really well explained in that book.

RoiiG
11-03-2010, 03:06 PM
Uhmmm i see..Maybe is it better to wait for another book? hehehe

I will check OpenGL ES 2.0 Programming Guide, and yes i intent to focus only on GLSL for now, because i think that i know the basics about opengl except how to code simple shaders.

Thank you!

david_f_knight
11-03-2010, 05:25 PM
i think that i know the basics about opengl except how to code simple shaders.If your goal is coding simple shaders, then you really don't need any book. Simple shaders are really just that: simple! Very, seriously, simple. My typical vertex shader is just one short executable line long.

Here's my typical actual vertex shader:

#version 400 core
uniform mat4 Modelview_matrix;
in vec4 Vertex_ap;

void main (void) {
gl_Position = Modelview_matrix * Vertex_ap;
}I use tessellation shaders (which no book teaches) which is where I calculate surface normals and apply the projection matrix, but if I wasn't doing that then I'd replace Modelview_matrix by ProjectionModelview_matrix and I'd have to add another line to deal with the normal vectors.

Simple fragment shaders are no more complex than simple vertex shaders. A flat shading fragment shader only requires one short executable line. You can throw in ambient, diffuse, and specular lighting in another two or three lines or so.

For learning simple shaders, I recommend looking at a few tutorials and examples on the internet, download and glance through parts of the free GLSL spec as you study the examples, and experiment a little. And once you've achieved that, building on that for more complex shaders is simple.

Incidentally, the GLSL language syntax has changed from version to version. So, if you do buy a GLSL book to learn shaders, as Aleksandar already pointed out, whatever book you do buy (even if you wait for some new book) it will be obsolete the day it's published and teach you syntax for some obsolete version of GLSL.

Alfonse Reinheart
11-03-2010, 06:23 PM
Incidentally, the GLSL language syntax has changed from version to version. So, if you do buy a GLSL book to learn shaders, as Aleksandar already pointed out, whatever book you do buy (even if you wait for some new book) it will be obsolete the day it's published and teach you syntax for some obsolete version of GLSL.

Except for the change from 1.20 to 1.30, all of the changes have been additions. So even if it is "obsolete", it will still work.

nickels
11-04-2010, 07:59 AM
I have both the orange book and superbible. If you can only buy one book, I would suggest the superbible. The orange book is more of a technical reference, and would be frustrating as an only reference. Superbible is goofy and suffering an identity crisis, but is still good and has enough of the new stuff to be quite useful. So basically sort of what Aleksander said, +1.

Groovounet
11-04-2010, 10:33 AM
The Superbible 5th edition is such the Red Book of modern OpenGL. It is OpenGL 3.3 based which is really mature as an API on contrary of OpenGL 4.1 which isn't "production ready" to me. That's a great choice to start until The Superbible 6th edition for OpenGL 4.2 got release.

For me the only way to go for anyone.

I don't find the Orange book really interesting... I bought the 1st edition and it was already kind of "obsolete" I think.

Forget about the Red Book as well, it is really obsolete.

RoiiG
11-04-2010, 12:58 PM
Hehe I bought the Red Book when it was released.. and was a total waste of money.. :( I bought it to learn 3.1+ features,VBO,VAO and all this new stuff for me and it barely explain those things.. instead, for example there is an entire chapter about Display Lists that are deprecated or opengl selection.. The problem is not that the book explains the Display lists or another deprecated feature, the problem is that the book don't explain very well how to do the same with non-deprecated/new features.

I learnt more reading the opengl 3.3 core spec pdf than the last red book, and with Alfonse awesome tutorial, Groovounet awesome GLM library, I'm starting to get the idea about all the new stuff.

I bought the superbible :), thank you all.

BTW Alfonse any ETA for the new chapters? ^^U

Alfonse Reinheart
11-04-2010, 02:39 PM
BTW Alfonse any ETA for the new chapters?

Some time next week I should have a new one up.