Slashdot Mirror


Recommendations For C++/OpenGL Linux Tutorials?

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."

13 of 117 comments (clear)

  1. NeHe's good! by Xetrov · · 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 :)

  2. They are both platform agnostic. by ville · · Score: 4, Insightful

    C++ and OpenGL are both platform agnostic, why do you need the tutorial to be for a specific platform? Perhaps you need a tutorial on how to use your toolchain to compile C++ and OpenGL programs or linux?

    // ville

  3. Re:Have you tried this thing called 'Google'? by Assmasher · · Score: 4, Funny

    Yeah, I cringed after I posted... LOL. Sorry, after reading the title I didn't bother reading the rest because NeHe has Linux versions of just about everything (which I've helped with.)

    I guess I ASSumed nobody would look at NeHe and then ask where to get Linux/OGL tutorials :). Hehe. A poor start to the day.

    --
    Loading...
  4. LazyFoo might help by Drethon · · Score: 5, Informative

    LazyFoo's website http://www.lazyfoo.net/ has tutorials on SDL (a very simple 2d sprite engine).

    I don't know if he has basic tutorials but he has tutorials in Windows, Linux and other OSes too I think.

  5. All you're really looking for is one tutorial... by llvllatrix · · Score: 4, Informative

    ...on how to get your rendering context setup in Linux. Here are a few:

    http://www.wxwidgets.org/docs/tutorials/opengl.htm
    http://projects.gnome.org/gtkglext/

    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/

  6. Re:Have you tried this thing called 'Google'? by NJRoadfan · · Score: 3, Informative

    It might be primitive, but using GLUT is always an option. Its cross platform and usually the examples run on all platforms without modification. http://www.opengl.org/resources/libraries/glut/

  7. Standard C++ books by porsche911 · · 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

    1. Re:Standard C++ books by trurl7 · · Score: 3, Interesting

      Koenig's "Ruminations" are beautiful! So glad you included it!

      Definitely second that list. I would add Alexandrescu's "C++ coding standards" (I'm an Andrei fanboy), and Sutter's "Exceptional C++: 47" and "Exceptional C++: 40 new".

      For the very beginning of C++, I like Lippman's "Essential C++", and, when you're feeling up to it, Lippman's "C++ Primer". If you want to know how C++ works under the hood, read "Inside C++ Object Model", also by Lippman (it's heavy lifting, and not needed for just using the language).

      There are some other nice books around this topic, but I think these two lists complete the 'core'.

  8. Dear god no! by Anonymous Coward · · 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.

  9. I think you're really asking 2 different questions by jimrthy · · Score: 4, Informative

    I say that, because I was asking myself pretty much exactly those same questions just a few months back.

    1. You want to learn OpenGL
    2. You want to broaden your horizons to C++

    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

  10. That's 3 subjects (of varying complexity) by njord · · Score: 4, Informative

    I just want to point out that there are 3 different topics you're talking about there:

    1. C++
    2. OpenGL
    3. Development/building on Linux

    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), but there are several that are very good.

    Good luck!
    njord

  11. Source code of glxgears by BerkeleyDude · · Score: 3, Interesting

    Get the sources of glxgears (in mesa-utils), and look through the code. It's relatively simple, and will help you get started.

    Also, when I was looking for an OpenGL example that uses just X11, without Qt/Glut/whatever, the best one I could find was this: http://msdn.microsoft.com/en-us/library/dd318252(VS.85).aspx (Yes, the irony is overwhelming...)