



Recommendations For C++/OpenGL Linux Tutorials? 117
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: (Score:1)
I'll also vouch for this. Having just finished (today actually) Advanced Computer Graphics at my university (which is OpenGL and SDL on Linux), using NeHe's tutorials helped a lot. Going down at the bottom of the page you can either use GLUT or Linux versions of the source to get a very good version of what is already on the site. They even build on previous lessons.
However I must say that the site is growing old. It references a lot of depreciated functions and, quite frankly, is not the best method to lea
Re: (Score:2)
They are both platform agnostic. (Score:5, 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?
Re: (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.
Re: (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?
Re: (Score:2, Insightful)
Re: (Score:1)
But the Windows specific code is stuff that you've learned in lesson 1 (which as I say is the only one that's platform specific) - it's just the basic stuff to set up OpenGL with your OS. The things that you learn in that lesson aren't Windows specific - and if you're not sure how to set up OpenGL with your OS, you shouldn't be doing that lesson yet.
The bottom of the page has links to the Linux code.
Re: (Score:1)
...in fact, that lesson states:
"The CreateGLWindow() and WndProc() code hasn't changed. So I'll skip over it."
So the implementations of those functions aren't covered for any platform, Windows included.
Re: (Score:1)
Indeed - basically all NeHe is lacking is a Linux version of http://nehe.gamedev.net/lesson.asp?index=01 [gamedev.net] , instead of just Windows, Solaris and OS X. The rest of NeHe works fine.
I think a bigger point to watch out for is that some of NeHe's tutorials are quite old, and not that relevant for modern rendering techniques (e.g., immediate mode, display lists).
Re: (Score:2)
I didn't know windows c++ allowed you to run
#include
Re: (Score:1, Informative)
you can use < and > for smaller-then and greater-then signs in slashcode
Re: (Score:2)
Re: (Score:3, Insightful)
That is no longer the case. However, it doesn't matter; you shouldn't be using the headers directly, you should be using GLEW.
I'm pretty sure that was around a few years back, too.
Re: (Score:2, Informative)
Re: (Score:2)
Perhaps you need a tutorial on how to use your toolchain to compile C++ and OpenGL programs or linux?
It isn't that simple. Both C++ and OpenGL only cover a small segment of what is needed for 3D applications and games. There is a lot of stuff not covered by either of those that are very much platform specific (controllers, sound, networking, etc.).
That said, NeHe's tutorials are still perfectly fine since most (if not all) of them have Linux conversions of the platform-specific stuff that you can download at the end of each tutorial.
It's OpenGL -- platform independent (Score:2)
Since the question is specifically on OpenGL, I'd expect the tutorials to easily be converted to any other platform.
Re: (Score:2)
OpenGL is indeed platform independent, apart from opening a window or getting input from the user. So long as you never need to do either of those, you don't need a platform-specific tutorial.
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.
SDL+OpenGL/3D Tutorials (Score:1)
2D samples are great, and I see that the last touches on OpenGL, but does anyone know a place with some more in-depth tuts for SDL+GL?
Re: (Score:2)
In the last few months i've been working on reteaching myself C++, as well as using SDL and OpenGL for writing a "tactics" style game (as a way to learn this stuff). I used both code from LazyFoo and NeHe for most of what I learned, and google for everything else. It's worked fairly well, I got a nice framework for writing a GUI and already have a lot of the graphics work going for the game itself, now I'm just looking at writing my own 3d model loader for some more complex stuff.
I honestly found the most
Re: (Score:1)
It definitely does sound like we're in the same ballpark. I've been working from the "red book" and built a hierarchal class system for scene->object->element->face->vertex and camera, etc. My camera pitch rotation is a bit messed when it hits 180 but otherwise it was going well until life distracted me from the hobby-coding again. I'd love to trade ideas/assistance in porting the base GL code up to something like SDL or Ogre.
Email me ph3or7mix@ph6o8rmi1x.c3om. (Remove the numbers, it's obfuscat
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: (Score:2)
Game engines (Score:1)
You could try getting involved with some existing game engines written for Linux/whatever else. Learn the engine basics then get into the guts of it. Check out Irrlicht Engine for one, last time I was there it seemed a friendly and helpful crowd on the forums.
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
Re: (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 la
Re: (Score:1)
Re: (Score:1)
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
If you're looking for something that's mainly syntax, but with some really good examples and and practice exercises (with accurate solutions online), try C++ Primer Plus by Steve Prata. Very good book.
http://www.pearson.ch/Informatik/SamsPublishing/1449/9780672326974/C-Primer-Plus.aspx [pearson.ch]
Re: (Score:2)
Stroustrup's book is horrible for learning C++. Poorly organized and rambling. I'd pick up a learn X in 24 hours book before Stroustrup.
Re: (Score:1)
Agreed. It isn't meant for raw beginners but it is still the best reference for the language and essential for a hard core C++ programmer to have as a reference.
Thanks for adding the Lippman Object Model book. Another very worthwhile book to have if someone wants to be a real C++ guru.
Re: (Score:2)
Agreed. It [Stroustrup] isn't meant for raw beginners but it is still the best reference for the language and essential for a hard core C++ programmer to have as a reference.
Gotta disagree with you there. I thought the same until I picked up O'Reilly's C++ in a Nutshell one day on a whim. Since that day, the only time I've found myself turning to Stroustrup is when the Nutshell book is at another site. K&R was/is the best reference for C, and a lot of people (including me) assume(d) that the same magic applies with Stroustrup and C++, but I'm here to tell you that my search time for the answers to questions about C++ has dropped dramatically since I abandoned that notion.
GLEW: The OpenGL Extension Wrangler Library (Score:1)
Why not look at an existing game engine? (Score:2)
Why not take a look at the code for an existing game engine like Quake (1/2/3) ?
Re: (Score:3, Insightful)
Why not take a look at the code for an existing game engine like Quake (1/2/3) ?
That's a bit too much for a beginner if you ask me. Better start out with some simple sprite based game to learn the basics and move on to 3D from there.
I'd look at... (Score:1)
I'd look at:
www.cplusplus.com
www.thefreecountry.com
www.cprogramming.com
Those sites are good for beginner/intermediate programmers, to start with. (Really, it depends on whether or not you have a good foundation in C/C++, as to where you should look...)
Good luck!
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.
Red book helped me. (Score:2)
http://www.glprogramming.com/red/
I don't have any of the other links I used when I was learning it, but I do have the source from the maze toy program I wrote while I was doing so.
http://www.bravegnuworld.com/~rjune/maze.tar.bz2
I hope it helps you.
Use Qt (Score:4, Insightful)
Re: (Score:1)
Re: (Score:2)
I recommend http://zetcode.com/tutorials/qt4tutorial/ [zetcode.com] for learning the basics. Nokia also has some excellent tutorials [nokia.com] examples [nokia.com] and documentation [nokia.com].
SDL/OpenGL tutorial (Score:1)
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 r
Re: (Score:2)
I'm the author of that book.
I'm sorry you didn't enjoy the book. The book's structure and format followed that of its predecessor (the first edition) which was written by different authors. It was not possible to put entire code listings into the text of the book due to space limitations, which is why the book came with the full source on the CD.
That said, the initial print run of the book had a fault with the project files on the CD, they did indeed have absolute paths. I posted updated versions on the boo
Two quick points (Score:2)
1) OpenGL and C++ are both multi-platform, so I don't get why you need something specifically aimed at Linux. You can't just translate Windows C++ samples?
2) Since video games aren't CPU-bound anymore, and since Python is a *much* cleaner and easier language than C++, and since Python has OpenGL libraries available-- why?
The only benefit you're going to get from this is the knowledge that C++ kind of sucks compared to Python. I can tell you that right now and save a lot of time.
Re: (Score:1)
Re: (Score:2)
Nehe's tutorials tie the OpenGL stuff into a game application framework that's totally Windows based--win32 event handlers, windowing code, etc. After following them all through, you've got something that's basically impossible to port to Linux, and learning OpenGL this way, you need that application scaffolding to do any useful work with the library.
Multi-platform C++ (Score:1)
C++ is multi-platform.
#include "stdafx.h"
#include "resource.h"
#define MAX_LOADSTRING 100
// Global Variables:
HINSTANCE hInst;
TCHAR szTitle[MAX_LOADSTRING];
TCHAR szWindowClass[MAX_LOADSTRING];
Framework helps (Score:1)
GL version (Score:2)
You need to figure out which version of GL you want to learn.
The newer versions of GL completely remove immediate mode (glVertex3f() etc)...
My memory is a bit rusty but I think GL 3.2 removed immediate mode completely. Its definitely removed from the recently announce GL 4.0.
Its a shame because immediate mode makes learning GL all the more easier to learn.
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_Th [opengl.org]
Skip some basic steps (Score:1)
C++ FAQ Lite (Score:2)
I used this site a bunch when I found myself doing some c++ work after almost exclusively working in java.
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
NeHe is horribly outdated (Score:1)
Look for OpenGL ES 2 books and tutorials, e.g this one : http://opengles-book.com/index.html [opengles-book.com]
OpenGL ES is OpenGL minus the totally outdated stuff you should never pay attention to (and which is sadly used in most web OpenGL tutorials, because they're all old), i.e it's a subset of OpenGL and is the right way to learn and do OpenGL programming today.
Source code of glxgears (Score:3, Interesting)
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 [microsoft.com] (Yes, the irony is overwhelming...)
VTK (Score:1, Interesting)
If you really be able to make complicated 3D scenes quickly I'd recommend learning VTK (Visualization ToolKit). It's what professional visualization researchers use to display data, has a bit of a learning curve but it has a ridiculous number of 3D graphics algorithms (extrusion, creating meshes from point clouds, transformations, importing data from various formats, etc. etc.)
Also if you really want to be able to prototype ways to visualize 3D data quickly there are python bindings :)
recommended book and IDE (Score:1)
Qt might be a good choice (Score:2)
I'd start by downloading the full SDK here [nokia.com].
Then fire up Qt Creator, go to welcome screen getting started tab, and dig into the rather interesting and well-documented examples. Hint: QGraphicsView combined with OpenGL is probably the way to the future, especially if you're not interested in building traditional boring GUI applications.
If you want a little more help getting started, google "qt tutorial" for more adding-features-step-by-step type stuff.
C++ & OpenGL (Score:2)
There is really nothing about the OpenGL API that is in any way object-oriented. It's not just procedural, it's procedural with global state variables. So if you want to build your 3D software in OO style, your first task is going to be making object-based wrappers around the procedural OpenGL code.
So basically, you can forget about C++ and use C, Ruby, Java, or anything else you fancy while learning OpenGL from the tutorials you've already been pointed at. Then you can learn how to wrap procedural C in a C
Just use NeHe (Score:2)
Yes, I read the question. Scroll to the bottom of the NeHe tutorial pages and see that most of them have Linux, Linux/GLX, and/or Linux/SDL code downloads.
Use those. The OpenGL stuff is the same as it's cross platform. The Windows-specific stuff will have been replaced with Linux-specific stuff, and after a quick glance, is explained about as well as the windows-specific stuff (which is to say, mostly glossed over, since NeHe does OpenGL tutorials, not Windows/Linux/whatever tutorials).
If you're having p
Joanjett (Score:1)
Re: (Score:2)
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
Thanks for RTFS
Re:Have you tried this thing called 'Google'? (Score:5, 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.
Re: (Score:2)
Re:Have you tried this thing called 'Google'? (Score:5, Funny) ... 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.
by Assmasher (456699) writes:
Perhaps you've got something else on your mind
Re: (Score:2)
Perhaps you've got something else on your ASS
Re: (Score:2)
Well, since you've assked ;), the name comes from an old Dragon magazine short story about a stubby little dwarf with a giant warhammer he's named 'assmasher' and he does a lot of mashin' in the story - for some reason, as a 10 year old this really hit my funny bone when I read it (weird, I know.) It's a poor choice of nickname but I started using it in the BBS days and am pretty much stuck with it now.
Re: (Score:3, Interesting)
I forgot to add, the framework comes in Linux flavors. I have contributed to the Linux tutorials myself there.
Re: (Score:2)
I remember a couple of years ago trying to get some of those working in windows and it complained about glaux.
There's some "glaux replacement code" but I couldn't get that working either.
So any any idea if the tutorials will ever be updated to work out of the box so that newbies can avoid worrying about dependencies until they have a handle on the material?
It massively detracts from the value of the tutorials to newbies when the tutorial code simply doesn't work which is a pity because they're good tutorial
Re: (Score:1, Insightful)
that's all you should know - those are not tutorial for the newbie in how to fix dependencies or learn c++
if you need help in replacing a library in your ide of choice, you should restart from hello world and work all the way up from there again.
those are tutorials about opengl - please LEARN the language BEFORE.
Re: (Score:3, Insightful)
A tutorial which simply doesn't work is still a broken tutorial.
Re: (Score:1, Insightful)
each ide has its own project definition file, each one differing in how to track library dependencies.
if you think that a tutorial failing to provide project definition for every ide out there is broken, probably you had newer worked on a real project.
as I said: learn the language, the ide you're working on, and stop complaining about non issues.
Re: (Score:2, Funny)
I have contributed to the Linux tutorials myself there.
If I reference your work, how would you like to be listed? As "Assmasher", "Mr. Assmasher" or "Dr. Assmasher", assuming you have a PhD?
.
Re: (Score:1, Informative)
You ever heard of reading the summary?
Re: (Score:2, Interesting)
Parent obviously didn't read the summary. But that said, the code written in NeHe's tutorials are ported to like 20 or more platforms, and you might find that to be useful.
I learned OpenGL by buying a copy of the Red Book [amazon.com], and then used Allegro [sf.net] (a cross-platform gaming library) to set up a rendering surface. This could also be accomplished by using the SDL [libsdl.org] library, but I do not have any experience using it.
(Regarding Allegro, the 4.4 series is a completely different API from the 4.9 series in development,
Re: (Score:1, Redundant)
Yes, shamefacedly, plus - need coffee. Actually I ASSumed from the title alone they hadn't seen NeHe since Linux versions are pretty much all there. One awwww-shit screws up fourty-five atta-boys...
Re:Have you tried this thing called 'Google'? (Score:4, Informative)
Re: (Score:2)
Re: (Score:2)
And Thirded. GLUT / freeGLUT is simply the easiest way to get an OpenGL application running without having to create the window, the opengl context, etc. GLUT library documentation is: http://www.opengl.org/documentation/specs/glut/spec3/node1.html [opengl.org]
Re: (Score:1)
As OP explicitly said C++, I have to wonder, are they looking for an Object Oriented type of framework? If so, GLUT doesn't fit the bill, it's a pure C, function callback oriented framework. It could be used in an OO like manner, but it isn't OO itself.
The only OO framework I've found for use with OpenGL is FLTK, but my experience with OpenGL is quite limited. What other OO frameworks are available and worth the effort to learn?
Allegro is not compatible with PulseAudio (Score:2)
Re: (Score:2)