Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I stumble upon the search of a good resource to start with OpenGL (3.0 or later) . Well, I found a lot of books but none of them can be considered a good resource!

Here two examples:

OpenGL Programming Guide (7th edition) http://www.amazon.com/exec/obidos/ASIN/0321552628/khongrou-20 This is FULL of deprecated material! Almost every chapters begin with a note about that.

OpenGL Superbible (5th Edition) http://www.amazon.com/exec/obidos/ASIN/0321712617/khongrou-20 This book uses a library created by the author to explain the main arguments, hiding what you want to learn! I don't want to learn how to use your library! I want to learn OpenGL!

I hope that you understand this is not the same question like "hey I'm not able to use Google... tell me how to learn OpenGL". I've just finished a full and deep search but I can't find a good and complete resource to learn the "new" OpenGL avoiding deprecated topics.

Can someone heading me in the right direction? I know C++ and I have 10 years of experience in development... where I can find a good resource?! I want to spend time on it and I want to learn deeply.

share|improve this question

closed as primarily opinion-based by Byte56 Aug 2 '13 at 13:00

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

add comment

7 Answers 7

up vote 55 down vote accepted

I agree with out about the above books with a few notes:

  • The OpenGL programming 8th guide is now out and has be redone for modern OpenGL 4.3.

  • The SuperBible 5th ed, does provide you will a crutch library to start off but as you go through the book you reimplement the functionality of that library so by the end of it you should be fully versed. I also highly recommend wrapping OpenGL stuff in something if your using a object orientated language. I'm working on my own library for fun which seems to be the way to go, implementing it myself I understand all the ins and outs and I only need to put in the bits I actually use. Also you can abstract away some things like sending data to shaders (isn't shinyMaterial.setColor(Red) much nicer), this can also let you backport some stuff by providing legacy alternatives. There is also oglplus.

The main problem with learning modern 'core' OpenGL is that to get a basic pipeline up and running even if it's just to draw a cube you need to understand the following:

  • Matrix operations (use GLM if you on C++, you will also need a MatrixStack OpenGL Unofficial SDK's version here, or my simple one here.)
  • GLSL shader programming.
  • binding data to shaders and Vertex Buffer Objects. If you wanted to learn just real pure core profile they would all need to be implemented simultaneously and if anything is broken you just wont see anything and have almost no clue where it went wrong. That also doesn't cover things like basic lighting (where you need to learn the shading algorithms in addition to the programming language).

But you don't need to start in the deepend with the core profile. Use some of the deprecated functionality at the beginning, just about everything will still support it, then modernize it.

Another issue is that 'modern' OpenGL can really refer to 3 things:

  • The first one is the programmable shader pipline as opposed to the fixed function pipeline. The core 'modern' techniques have been possible since OpenGL 2.0 was released in 2004 when shaders where introduced (the tutorials just didn't get updated) also 1.5 had Vertex Buffer Objects's which are another cornerstone of modern OpenGL. A problem is that even today OpenGL developers might not even be able to take advantage of all that stuff, there are plenty of crappy netbooks out there with those Intel chipsets that only support OpenGL 1.5 and phones such as older iPhones/Android ones that only support OpenGL ES 1.1. The only real difference between this stuff in OpenGL 2.0 and OpenGL 3.x/4.x is it's now mandatory for the core profile.

  • Modern OpenGL could also refer to the new stuff that's in 3.x, 4.x. Things like Vertex Array Objects, Framebuffer Objects, Uniform Buffer Objects/std140, layout qualifiers, GLSL subroutines and so on. Many of those I have found can make things much much nicer to program with. They can also subtly change your overall engine pipelines. They are also things that with a little effort you can backport by making helper functions and so on (For example write a generic shader manager object that you can use to set uniforms, if UBOs are supported use that otherwise manage uploading the values to shaders manually, maybe put a little shader rewriting stuff in there to automate it). This stuff only runs on new video cards, you wont see any netbooks supporting it or any current generation video game consoles (they use their own subset of OpenGL similar to OpenGL ES). The latest OSX only have 3.2 support and I understand that they will be fixed at this version forever since Apple write their graphics drivers and specify OpenGL versions based on the OS version not the GFX drivers/video card capabilities the only way for a user to get a new OpenGL on a current generation Mac would be to pay for an upgrade to a new version of OSX.

  • The Ultra Modern nextgen OpenGL. OpenGL 4.3 was just released. It comes with compute shaders, glMultiDrawElementsIndirect and shader storage buffers. This allows for a fundamentally different pipeline where you upload all the vertex data to the GPU and then use compute shaders to calculate what should be drawn rather than doing it in your program. Unfortunately this is very new so I don't know of any decent tutorials on it. Take a look at the OpenGL 4.3 review which gives an outline of how this works (also the author says there is a GPU Pro article to be released explaining it). Being brand new it's not going to be supported anywhere at this stage (unless you're on a newer nvidia card with beta drivers). Although you might be able to use OpenCL/CUDA to implement some of it.

I would skip glBegin, glEnd, glVertex*, glNormal*, glTextCoord*, glTranslate*, glRotate*, glLoadIdenity, glModelViewMatrix and so on. Instead start with learning Vertex Buffer Objects without shaders, don't try 3D at this point just a flat white triangle so you don't have to work with 3d operations using matrices (as you will need to learn to bind them to shaders soon so no sense in learning to old way). Next add in in the shaders, you will need to change how your vertex buffer objects are bound since you will now want to use vertex attributes. Learn how to communicate properties to them via uniforms. Then learn matrix operations with GLM, bind the matrices to the shaders and get 3D going. Once you have that done then it's basically just learning more advanced things like texturing, lighting and some special features like framebuffer objects, vertex array objects, uniform buffer objects, GLSL routines and so on (those are all things I recommend you have a look at. Most of it is fairly new except for texturing and lighting but if you learn them as shader concepts rather than as OpenGL ones, you should get the modern approach).

Some general online modern OpenGL tutorials, covering the shader programming pipeline that most of which works with OpenGL 2.0+:

For other general learning resources. OpenGL ES might be a good starting point. OpenGL ES has stripped out all the deprecated stuff. OpenGL 4.1 has full compatibility with OpenGL ES so it should be possible to take an OpenGL ES program and run it in OpenGL 4.1. And the basic principles are the same for both.

Some things to note is that OpenGL ES 3.0 has just been released but as it's new, it won't have any tutorials or hardware support yet. It doesn't seem to have any major fundamental changes (like the difference between fixed pipeline and shader model that we saw with OpenGL ES 1.0->2.0). So you probably won't be learning any out of date stuff.

Also, OpenGL ES will often be using EGL so you will need to learn another way to open a Window but that shouldn't be too hard. Otherwise there are a few OpenGL ES wrappers/emulators around or you can learn on Android/iPhone if you have one (or look at using their emulators).

There is the Addison Wesley OpenGL ES 2.0 Programming Guide which is the equivalent of the red book.

You can also look at GLSL shader focused stuff since that's where most of modern OpenGL lives. You just need to ensure what you learn covers the OpenGL binding 'glue' side of things.

Check out the OpenGL Shading Language 2nd edition (Orange Book).

The OpenGL 4.0 Shading Language Cookbook covers some more bleeding edge OpenGL stuff but isn't itself a comprehensive tutorial. Its definitely worth a look to get some understanding in the latest real world OpenGL practices such as uniform buffer objects and GLSL subroutines.

Finally you could have a look at WebGL, although being in JavaScript that is going to be somewhat different and much harder to debug.

share|improve this answer
3  
+1, wow. The only small change I'd suggest would be using client-side vertex arrays at the start as they're an easier path to VBOs but without some of the bear traps that beginners can fall into. –  Jimmy Shelter Jul 24 '12 at 19:19
1  
I figured it was best to avoid specifically learning/using deprecated functionality since that would be stuff that would have to be unlearned. The other deprecated stuff I suggest using is things that OpenGL will do by default, like being able to render without using a shader and assuming vertex attribute 0 is the position both of which should explode when switching on the core profile. –  David C. Bishop Jul 24 '12 at 23:39
    
+1 for the wikibooks page. –  danijar Aug 6 '12 at 14:50
1  
The 6th edition of the SuperBible has just been released and it is MUCH better than the 5th edition. I highly, highly recommend it, it's easy to following and learn modern OpenGL with. –  Philip Aug 25 '13 at 3:27
add comment

Forget about books atleast untill the 8th edition of the programming guide comes out.

Besides the mentioned tutorial, i found this site to be helpful, since it goes past the basics fairly quickly. They're both a great introduction to modern OpenGL. Once you get past that, you'll only need the docummentation, OpenGL is easy to use once you get used to it. The rest is computer graphics theory and mathematics.

share|improve this answer
add comment

I have been in the exact same situation as you and have finally found what I needed to get going.

First off head here: http://www.arcsynthesis.org/gltut/. This site is fantastic, good working examples and deep explanation of what is going on. Even though the code is written in C++ I'm using this to teach me writing OpenGL demos in Lisp. It also is totally free of the old way of doing things so you don't have to worry about picking up bad habits.

I would stress that even though its 'just another website' I haven't found any books which give as clean and concise an explanation of the basics as this does.

Once you have got through the site above you will already have a basic grasp of shaders and a lot of what you need to know can now be googled (have a good look at the opengl es or webgl resources as they removed all the deprecated stuff) or found in the opengl wiki site. The later is horrendously cryptic if you don't have the fundamentals from the arcsynthesis site under your belt but quite helpful when you know roughly what you are looking for.

Also for a really deep look at GLSL then have a gander at: OpenGL Shader Language (The Orange Book) I'm working through this very slowly but will give you the understanding of writing shaders to allow you to take this pursuit on further. I'll warn you that this book does have, in the words of a reviewer, "200 pages of top quality content packed into a 600 page book" but the extra history and info can provide the context you need to understand the routes that OpenGL as a standard has gone down (well it's helping me anyway!)

I hope this helps and best of luck, I look forward to seeing/playing your work in the future!

share|improve this answer
2  
OMG! the first link is fantastic! –  MatterGoal Jul 24 '12 at 14:37
add comment

Also check out Open.gl. It has tutorials using modern Open GL

share|improve this answer
    
Thanks for pointing out these new tutorials :) –  legends2k Jan 16 '13 at 8:14
    
Yep. I've never seen this website! thank you :) –  MatterGoal Feb 1 '13 at 12:21
add comment

Two sites that have been very helpful for me are: http://www.arcsynthesis.org/gltut/ and http://ogldev.atspace.co.uk/

Also, the OpenGL wiki is an extremely good and up-to-date resource.

Once you get through these, I highly recommend biting the bullet and reading the OpenGL specification. Then you'll be a pro.

share|improve this answer
    
Yes, I find the online tutorials to be much more useful than most books. The SuperBible 5th edition is extremely disappointing. –  Philip Aug 3 '13 at 14:53
add comment

The best book I've come across that covers "modern" OpenGL is http://www.packtpub.com/opengl-4-0-shading-language-cookbook/book

Even though it's a "cookbook", it does walk you through necessary steps to set up rendering and what kinds of companion libraries you'll need (image lib, vector math lib).

In addition to that it goes through all sorts of common things you might want to use OpenGL for, without digging too deeply into anything (like for shadows, it covers shadow mapping and filtering shadow maps, but doesn't go into any of the more complex shadow mapping methods).

I also recommend getting the orange book.

share|improve this answer
    
Thank you @Jari. Isn't it "only" about shader? I mean, does this book introduce to OpenGL techniques as well as shaders? –  MatterGoal Jul 24 '12 at 14:36
1  
@MatterGoal: Modern OpenGL is almost completely shader based. This book does cover the OpenGL binding side of things. I also recommend this book but as a companion to something else, its not really for core learning book but does show some great realworld uses of moddrn practices. –  David C. Bishop Jul 24 '12 at 15:04
add comment

Some more Tutorials and stuff which wasn't mentioned but helpful

share|improve this answer
    
+1 To add to the list, there's OpenGL tutorials by Aks which is not very structured but has enough information for setting things up. –  legends2k Oct 26 '13 at 7:15
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.