PDA

View Full Version : Learning opengl



Hazemat
09-20-2010, 06:36 PM
Im think about learning opengl using C++, I already know a good enough amount of C++ and I was wondering if anyone could point out some good Opengl books with c++?

shadowayex
09-20-2010, 07:56 PM
The Red Book (OpenGL Programming Guide), the Blue Book (OpenGL SuperBible), and the Orange Book (OpenGL Shading Language). If you can't get them all, start with the Red Book. They don't code specifically in C++, but it's easy enough to work with.

I'm porting code to OOP. Each object I make has a draw() function where all of the OpenGL drawing stuff goes for the object, and it's called in the display function (the Red Book explains this).

Those are the best books I know of for OpenGL

BionicBytes
09-21-2010, 07:58 AM
As Shadowayex has said..... the OpenGL programming guides give comprehensive information and are quite easy to follow. However, they are not as good as they should be - giving opengl example code based on legacy ways of doing things rather than pure GLSL solutions. This was a major gripe of mine with the fifth edition (OpenGL 2.0/2.1). So the text is great, but treat the examples with a pinch of salt!

david_f_knight
09-21-2010, 12:08 PM
Oh boy. Great question, Hazemat. As far as I know, there is absolutely [B]NO good introductory OpenGL book yet, with or without C++. By good book, I mean one that teaches introductory modern OpenGL, rather than the obsolete OpenGL that it seems most of the newbies are learning here. (I don't mean to cast too wide a net; there may well be some excellent advanced OpenGL books, but the question here is specifically about introductory learning of OpenGL, not advanced topics.)

Not to be presumptuous or arrogant, but I have to wonder, based on the recent questions I've read in this forum, whether most of the newbies are even aware that there are essentially two very different OpenGLs that co-exist side-by-side: that which uses the legacy fixed function pipeline (which is essentially obsolete though it is still supported), and that which uses the programmable shader pipeline. It makes me cringe to think that anyone, unless they have a specific requirement to do so, would be bothering to learn to program the obsolete fixed function OpenGL pipeline now. People can argue my point, and say that both the legacy and modern stuff can be mixed in a single program to some extent (compatibility profile), but to me that just muddies the waters and is what I consider poor programming practice. The old stuff is still there so that old programs will continue to work, and so that old programs can be routinely maintained and still work. But I don't see any significant reason to develop new programs with obsolete technology, or to learn to program with obsolete technology.

At the risk of being flamed because I have not read it myself, but according to most amazon.com reviews of the most recent version of the Red Book (the 7th edition), it is not very good for learning modern OpenGL, because it apparently presents all OpenGL (legacy and modern) and largely leaves it to the reader to sort out for themselves. One of the keys of helpfully teaching new material is to NOT present unnecessary or irrelevant information because that just overwhelms the student and leads to confusion and lack of clarity. A teacher/author should use his experience to filter out the unnecessary and to place into a proper context how the essential pieces fit together and what ought to be used, rather than what can be used. (In fairness to the book, it is comprehensive and never claims to teach just modern OpenGL. My view is that there are many old books that teach old OpenGL just fine, so there is no need for a new book to teach old OpenGL. There are no old books that teach new OpenGL, so that is where the need lies. But your needs are for you to decide.)

Though incomplete and still a work in progress and limited to OpenGL 2.0 (OpenGL is up to version 4.1 now), you might want to read this intro to modern OpenGL before you search for a more comprehensive introductory OpenGL book to read. This may help open your eyes to what you should be looking for and get you pointed in the right direction so that you can filter out for yourself the irrelevant information in the currently available introductory OpenGL books.

http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Table-of-Contents.html

I can't personally vouch for this, because I have not done it, but some OpenGL book reviewers have suggested learning OpenGL by reading books specifically about OpenGL ES 2.x, even if you are only interested in OpenGL on desktop computers. OpenGL ES 2.x apparently is exclusively modern OpenGL and has no legacy API at all. If you go this route, you will still have to find how to create an OpenGL context on whatever platform you are actually using, but that is pretty isolated code and lots of examples can be found on the net. If you're interested in learning up-to-date (i.e., version 4.x) modern OpenGL, what I have found is that once you have a basic understanding of modern OpenGL, such as perhaps from an OpenGL ES 2.x book, you can pick up much of what you need from the OpenGL core 4.x specification, which is free on this site. But unless you already understand modern OpenGL's concepts, the spec is largely incomprehensible.

I personally got started with modern OpenGL about three months ago by reading Beginning OpenGL: Game Programming, 2nd edition (2009). It had some useful and helpful information, but on balance I found it to be frustrating and incomplete; it oversimplifies too much, leaves too much out, and relies too much on legacy OpenGL. I almost never refer back to it now, relying instead on the OpenGL 4.0 core spec and information I find on the net. If I had it to do over again, I'd look into reading an OpenGL ES 2.x book to get started. I don't think any one book has all you need to know, though. There's more difference between legacy and modern OpenGL within any version of OpenGL than there is between modern OpenGL 2.0 and modern OpenGL 4.1.

These are just my opinions; your mileage my vary.

Alfonse Reinheart
09-21-2010, 02:13 PM
*cough (http://www.arcsynthesis.org/gltut/)*

A work in progress, to be sure. But it is progressing. And once it reaches a reasonable state of completeness, I'm considering having it published in book form.

Savalia
09-21-2010, 04:38 PM
@DAvid
From my experience, I'm using "Beginning OpenGL Game Programming" 1st ed(higher reviews than the 2nd ed) the book looks at OpenGL 2.1, exactly like everyone has previously posted, it looks at the fixed pipeline, but the follow up book "More OpenGL Game Programming" starts with VBo's from page 3. This books first four Chapters are a valiant effort to take readers of BOGLP into the world of shaders. Like you said, it's not for a beginner, sometimes you need to take a step back, to see where you will land after your big leap forward.

@Alfonse
Your "work in progress" is a more professional read, than many "technical" books on the shelves right now. I'm sure I'm not the first or the last to say, "PLEASE keep us informed of it's progress" (I hope I didn't forget to say PLEASE) ;)

Hazemat
09-22-2010, 01:00 PM
Well thanks for the answers guys! Right now all I really want to learn if the basics of opengl, and get some small projects done. As of right now I don't think it really matters if im using old legacy stuff, becuase itís not like im doing anything very professional right now. But later as I start to get the swing of things, I guess il start leaving the legacy stuff and try to go as modern as I can to keep everything up to date. So I think il go look for a copy of the OpenGL programming guide 5th edition, as bionicbytes said the text was easy to follow so that will be something that would help me out a lot.

nickels
09-22-2010, 01:29 PM
Oh boy. Great question, Hazemat. As far as I know, there is absolutely [B]NO good introductory OpenGL book yet, with or without C++.

I would have to agree.
Frank Luna's 'Introduction to 3D Game Programming with DirectX10' has to be, hands down, the best book on introductory (modern) graphics programming I have probably ever read. The mapping from that book to Opengl is very straightforward and I would love to see it done (I singularly lack the ambition to do it)!

RefleX
09-23-2010, 01:15 AM
Oh boy. Great question, Hazemat. As far as I know, there is absolutely [B]NO good introductory OpenGL book yet, with or without C++. By good book, I mean one that teaches introductory modern OpenGL, rather than the obsolete OpenGL that it seems most of the newbies are learning here. (I don't mean to cast too wide a net; there may well be some excellent advanced OpenGL books, but the question here is specifically about introductory learning of OpenGL, not advanced topics.)

OpenGL Super Bible 5th Edition (http://www.amazon.com/OpenGL-SuperBible-Comprehensive-Tutorial-Reference/dp/0321712617/ref=dp_ob_image_bk)

This book teaches OpenGL 3.3 Core Profile. I wouldn't bother too much with OpenGL 4.1 if I'm a beginner. So this is a great book for any one starting out.

david_f_knight
09-23-2010, 04:19 PM
Thanks, RefleX! OpenGL Super Bible 5th edition was published, according to amazon.com, August 2, 2010, so it's still hot of the presses! Too bad it hadn't been published just a couple months earlier when I got started. I've only heard good things about the OpenGL Super Bible books.

I wouldn't hesitate to get it even though it covers OpenGL 3.3 core rather than OpenGL 4.1 . The step from 3.3 to 4.1 isn't that big.

Hazemat, there's virtually nothing in common between the old OpenGL and the new, even including the basics. You won't be able to transfer hardly any of what will be your hard-earned knowledge of the old OpenGL to the new, and it may serve to confuse you more than just starting with the new from the get-go. Basically, what learning the old OpenGL does is it puts your mind into a small box. Then, when, and if, you decide to learn the new OpenGL, you'll probably find that you continue thinking inside that same old small box even though the new OpenGL exists in a whole new, larger, box. You'll keep trying to figure out how you're supposed to fit your square pegs into round holes without appreciating that the holes are all round now.

Switching from old to new is easier said than done, when it comes to OpenGL.

CGWsplatter
10-27-2010, 09:14 AM
OpenGL Bible is a good book for jumping right into coding, it helped me for my university assignment but it is really outdated and uses C not C++. I am currently following this tutorial (http://www.arcsynthesis.org/gltut/),sofar very refreshing and detailed, the only problem is that i cant find the associated source code files.