PDA

View Full Version : Difference between GLSL 1.2 and 1.3(1.4)



cipherovski
09-05-2009, 05:47 AM
I would like to learn GLSL with the "Orange Book".

Unfortunately I only got the second edition at free disposal. SO I would like to know, is there are big differences between GLSL 1.2 and 1.3(1.4)?

If there is a big difference, and it will be hard for me to switch from GLSL 1.2 to 1.4 at the appropriate time, then I would to swallow the pill and buy the third edition of the orange box now!

Thanks for any replies!

cipherovski

scratt
09-05-2009, 06:06 AM
Buy the third edition anyway.. It's worth supporting such a good source of knowledge!

Basically, like OpenGL, point updates don't mean that what you've already learned is obsolete. More often simply new features have been added.

So perhaps read the specs (available on this site) and familiarize yourself with the changes. They are always listed. And then you can make an informed decision yourself. :)

Aleksandar
09-05-2009, 07:17 AM
...If there is a big difference, and it will be hard for me to switch from GLSL 1.2 to 1.4 at the appropriate time, then I would to swallow the pill and buy the third edition of the orange box now!...
Why buying a book is a bitter pill to swallow?
Although I posted some comments that I'm not very satisfied with the third edition of the Orange book, I claim that it is worth having. Especially somebody who starts with GLSL.

And the price is acceptably low, so almost everyone could afford it (it is approximately a price of two lunches in the restaurant). ;)

cipherovski
09-05-2009, 09:07 AM
thanks for the replies!


it is approximately a price of two lunches in the restaurantWell, for me at the moment it's the price of 10 lunches :-(

My question remains: Would it be hard for me to switch from 1.2 to 1.4 at the appropriate time?

Aleksandar
09-05-2009, 10:31 AM
When I said two lunches, I meant for two people (or one for four). I would never go to the restaurant alone. ;)

If you buy a PDF version, as I did, the price is 20% less. And there is a discount after the registration, so that price is even less.

But let's back to the topic.


My question remains: Would it be hard for me to switch from 1.2 to 1.4 at the appropriate time?
No, it wouldn't be hard! In fact, the major version number is still 1, so those GLSL versions shouldn't differ too much. The most noticeable difference is a disappearance of attribute and varying qualifiers (now there are only ins and outs), and the blocks usage. GLSL 1.4 introduces named uniform blocks that are further generalized to interface-blocks in GLSL 1.5. Function ftransform() is also deprecated, and now you should use invariant qualifier. There are also layout qualifiers, but they are not covered properly in the Orange book 3rd Ed. The book also just declares functions and parameters for the uniform blocks, but without any usable examples.

I'm sorry if this post is too comprehensive. In short, go ahead and start learning GLSL 1.2. It is worth doing that!

cipherovski
09-05-2009, 11:26 AM
I'm sorry if this post is too comprehensive. No way! It was the answer I hoped to get.

thanks!

Dark Photon
09-07-2009, 11:01 AM
My question remains: Would it be hard for me to switch from 1.2 to 1.4 at the appropriate time?
No, it wouldn't be hard! In fact, the major version number is still 1, so those GLSL versions shouldn't differ too much. The most noticeable difference is a disappearance of attribute and varying qualifiers
That's just a minor syntax tweak. I'd actually suggest a bigger difference for most folks (going from 1.2 to strict 1.3) is the deprecation of nearly all the built-in gl_* uniforms and attributes, as this requires changes to the C++ code (implementing matrix stacks, flipping to user-defined uniforms, tracking light/material state, etc.). Not hard, just takes time. For instance:



global variable gl_FragData is deprecated after version 120
global variable gl_ModelViewMatrix is deprecated after version 120
global variable gl_MultiTexCoord0 is deprecated after version 120
global variable gl_MultiTexCoord1 is deprecated after version 120
...
global variable gl_Normal is deprecated after version 120
global variable gl_NormalMatrix is deprecated after version 120
global variable gl_TextureMatrix is deprecated after version 120
global variable gl_Vertex is deprecated after version 120
Keep in mind these are just warnings, so if you don't mind your compile logs getting filled up with this cruft hiding potential problems (I do mind), then strictly speaking you could ignore these when moving to 1.3, just as you could with the in/out attribute/varying deprecation too though.

Still, to the original question, it's not like the language is night-and-day different. You'll find it easier learning with GLSL 1.2 and all the built-in convenience uniforms. Then once you get that knocked out and are comfortable, upgrade your shaders and code to GLSL 1.3 or 1.4.

Make sure that the version of GL and GLSL you're targetting is supported on all all hardware you must support first though.