Recommendations For C++/OpenGL Linux Tutorials? 117
Posted
by
timothy
from the no-you-guide-me dept.
from the no-you-guide-me dept.
QuaveringGrape writes "After a few years of Python I've recently been trying to expand my programming knowledge into the realm of compiled languages. I started with C, then switched over to C++. A friend and longtime OpenGL programmer told me about NeHe's tutorials as a good step after the command-line programs started to get old, but there's a problem: all the tutorials are very Windows-based, and I've been using Linux as my single platform for a while now. I'm looking for suggestions for tutorials that are easy to learn, without being dumbed down or geared towards non-programmers."
NeHe's good! (Score:3, Informative)
Actually at the bottom of every article are downloads for a LOT of other platforms. Read the tutorial on the web, then look at the code for your platform, should be plenty of comments.
I learned the same way :)
Re:Have you tried this thing called 'Google'? (Score:1, Informative)
You ever heard of reading the summary?
Re:They are both platform agnostic. (Score:1, Informative)
Perhaps you need to read the summary? but there's a problem: all the tutorials are very Windows-based, and I've been using Linux as my single platform for a while now.
LazyFoo might help (Score:5, Informative)
I don't know if he has basic tutorials but he has tutorials in Windows, Linux and other OSes too I think.
All you're really looking for is one tutorial... (Score:4, Informative)
http://www.wxwidgets.org/docs/tutorials/opengl.htm [wxwidgets.org]
http://projects.gnome.org/gtkglext/ [gnome.org]
Beyond these, NeHe still applies. The exception are operating system specific APIs like playing sound, but those have nothing to do with OpenGL. After NeHe, you may want to consider using shaders, which are covered in the Orange Book:
http://www.3dshaders.com/home/ [3dshaders.com]
Re:Have you tried this thing called 'Google'? (Score:4, Informative)
Re:They are both platform agnostic. (Score:2, Informative)
Perhaps you need to read his comment, where he said "C++ and OpenGL are both platform agnostic, why do you need the tutorial to be for a specific platform?"
With the exception of the first lesson (which I address in my comment below), can you show me how NeHe's tutorials are only usable on Windows? Or indeed, how they're specific to Windows at all?
Standard C++ books (Score:5, Informative)
I would recommend the following books:
Alexandrescu - "Modern C++ Design: Generic Programming and Design Patterns Applied"
Meyers - "Effective C++" and "More Effective C++"
Stroustrup "The C++ Programming Language"
Stepanov - "Elements of Programming"
Koenig - "Accelerated C++"
Koenig - "Ruminations on C++" (A little out of date but still a good read)
Good luck, C++ has evolved into a large and complex language. You may want to read Stroustrups "The Design and Evolution of C++" on the side to understand how it developed.
-c
Dear god no! (Score:4, Informative)
Please don't look at the NeHE tutorials. Just buy the Red book or something and work from there.
The NeHe stuff is terribly ancient and lots of it is amazingly out of date, and never promoted very good programming practices.
I think you're really asking 2 different questions (Score:4, Informative)
I say that, because I was asking myself pretty much exactly those same questions just a few months back.
Both are good goals, but they're also two distinctly different goals.
Pyglet is a simple python gaming library that is an excellent resource for learning OpenGL. You get all the goodness of python, yet you're using the same OpenGL calls you'd use in a "real" programming language. It probably isn't stable enough for production, but it's much faster to learn when you have the command interpreter and don't have to wait around for the compiler/linker.
There are other OpenGL implementations for python, but I had the best luck learning by using pyglet. Probably because it's very low level and doesn't hide implementation details like, say, SDL does.
The NeHe tutorials are good for what they are. Like other posters have mentioned, they're a little out of date, and the programming style isn't all that great. But they're good, quick examples of getting something set up and seeing results pretty much immediately. Which makes them a good place to start...as long as you remember the grain of salt.
I definitely share your pain when it comes to setting up things like the rendering context, the camera, etc, etc, etc. There are tons of options, the man pages were not written for the beginner. Again, as has been mentioned over and over, the Red Book is probably your best bet.
Learning C++ is (really) a different question. I can't recommend the C++ FAQ Lite highly enough. You can find their recommendations at http://www.parashift.com/c++-faq-lite/how-to-learn-cpp.html [parashift.com]
My grudge against NeHe (Score:2, Informative)
But don't worry, the full source is on the CD. Of course, it's only for visual studios, and even if you get it running on that, it has to be in a specific hard-coded directory called "D:/book/code/examples" or something.
Re:They are both platform agnostic. (Score:2, Informative)
Re:They are both platform agnostic. (Score:1, Informative)
you can use < and > for smaller-then and greater-then signs in slashcode
Suggestions (Score:2, Informative)
Most of the tutorials are outdated and won't work in modern OpenGL core profile. Avoid tutorials that use glBegin(), glVertex(), glLight(), gluPerspective(), glMatrixMode(), glVertexPointer(), or learn just enough from them that you can create a context and draw stuff in Linux. After that you can adapt Windows-specific tutorials's code to Linux. I liked these tutorials:
http://sites.google.com/site/opengltutorialsbyaks/introduction-to-opengl-3-2---tutorial-01 [google.com]
http://www.opengl.org/wiki/Tutorial:_OpenGL_3.1_The_First_Triangle_(C%2B%2B/Win) [opengl.org]
That's 3 subjects (of varying complexity) (Score:5, Informative)
I just want to point out that there are 3 different topics you're talking about there:
Indeed, there are pretty deep concepts behind each of them: C++ is related to fundamental programming concepts, object orientation, and metaprogramming, OpenGL deals with framebuffer rendering/graphics, and Linux development deals with source control, Makefiles, compilers, and configuration setups.
These concepts are not orthogonal by any stretch of the imagination, but it might help to keep in mind that each of them can be studied without the other.
Speaking from personal experience as a 'graphics guy', I would suggest you look further than OpenGL if you want to learn C++. OpenGL is great, don't get me wrong, but it is just an API, and a fairly limited one at that. You won't learn much C++ trying to figure out how to set up texture contexts and binding VBOs.
I would recommend writing a raytracer or your down software-based rasterizing renderer (or both!) - you'll find youself diving right into the data structures that are important to graphics and tackling 'fundamental' problems that really test your programming abilities, versus realizing that you passed GL_LINE to glBegin() instead of GL_LINES or some stupid API issue like that.
Later, you can work on your OpenGL skills; heck, you could even play with it in Python if you're curious. You'll find that any API is easier and more satisfying to use if you say 'How does this API address the following problem in graphics?' as opposed to browsing through the API reference and saying 'Ooh, what does this function do?'.
As for the Linux part, my advice would be to read up on Makefiles and spend some time writing them for various projects. When you've really got a handle on them, you can move on to CMake or autotools or whatever - but jumping into those without knowing that basic mechanism does you a disservice. I'd also recommend experimenting with one of those fancy programming editor (I recommend The One With All of the Modifier Keys [gnu.org]), but there are several that are very good.
Good luck!
njord