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."
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 :)
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?
Most, when not all of NeHe's GL-tutorials have a Linux-port :)
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
Summation 2
I forgot to add, the framework comes in Linux flavors. I have contributed to the Linux tutorials myself there.
Loading...
You ever heard of reading the summary?
Years ago.
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...
Since the question is specifically on OpenGL, I'd expect the tutorials to easily be converted to any other platform.
8 of 13 people found this answer helpful. Did you?
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, and then used Allegro (a cross-platform gaming library) to set up a rendering surface. This could also be accomplished by using the SDL 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, but both can create a window for rendering OpenGL. I would personally suggest using the 4.9 series.)
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...
Loading...
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.
...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/
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.
C++ and GL are both platform independent. I think your question is more about learning a specific GUI. With Linux, you always have the option of learning to program with X (and then learn the GLX binding). However, other options will be to learn a cross-platform GUI like wxWidgets or Qt. In theory, programs written in wxWidgets or Qt can be directly compiled in any platform (even though there are always minor compilation issues).
If you just want to get your hands dirty right away, try GLUT, which just gives you a blank canvas to program with, but does not come with GUI support like buttons, menus, etc. Otherwise, both wxWidgets and Qt are good bets because they are commercially popular (whereas x windows is much less popular). Personally, I have some minor grips about GL support in wxWidgets, but most of them are fairly minor. As of Qt, I've not used in a long while because of their licensing policy, but I do remember it to be very stable.
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/
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
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 tutorials otherwise.
Not online tutorials but excellent books on 3d programming in linux and they cover 3d programming theory in general very well. They're a bit dated now but the fundamentals are still the same. Learn Linux 3-D Graphics Programming and Advanced Linux 3D Graphics Programming Author : Norman Lin Published by Wordware
Although the code in the tutorial it self is for the windows based version, Linux SDL and Linux GLX versions (along with many other versions) of the code are available at the bottom of each tutorial! -- For example take a look at the bottom of lesson 5: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=05
The basic OpenGL stuff is the same regardless of your platform anyway.
Other than that I would recommend getting some books, maybe get the OpenGL SuperBible. One of the things I didn't like about NeHe is that it's kinda old school OpenGL.
I still say the red book can't be beaten - http://www.glprogramming.com/red/
Get a grip on using OpenGL using GLUT, so you don't have to worry about windows or input or anything. When you have a grip on that, switch out GLUT for SDL, and you'll be laughing
http://glew.sourceforge.net/ GLEW also comes with the NVIDIA SDK: http://developer.nvidia.com/object/sdk_home.html NVIDIA SDK is also a good place to start with OpenGL.
...and thus we see why people hate developing for Linux...
http://www.beanleafpress.com
Why not take a look at the code for an existing game engine like Quake (1/2/3) ?
Don't blame me, I voted for Kodos
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!
Holy happy hippy crap!
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.
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.
Qt 3: * http://www.digitalfanatics.org/projects/qt_tutorial/chapter14.html Qt 4: * http://wesley.vidiqatch.org/03-08-2009/nehe-opengl-lessons-in-qt-chapter-1-and-2/ * http://wesley.vidiqatch.org/04-08-2009/nehe-opengl-lessons-in-qt-chapter-3/ * http://wesley.vidiqatch.org/08-08-2009/nehe-opengl-lessons-in-qt-chapter-4/
http://nehe.gamedev.net/wiki/LessonLinux.ashx
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.
Seconded. GLUT is probably the easiest way to get started. If you go to the GLUT page you'll also find a list of OSS alternatives to GLUT (GLUT is free but closed-source) if you'd prefer to use one of those. Although this tutorial makes a reference in the beginning to some MSVC-specific pragmas to set linker options, it's probably pretty good for your purposes on the whole. Finally, there are other forums more specifically geared towards the things you're interested in; e.g. gamedev.net.
Here's a tutorial to get you rolling with OpenGL in SDL under linux. Once you get rolling with that, you can proceed to the NeHe tutorials. http://cone3d.gamedev.net/cgi-bin/index.pl?page=tutorials/ogladv/tut1
A tutorial which simply doesn't work is still a broken tutorial.
I would simply recommend you not learn C++. I have a penchant for LISP, but in all seriousness I wouldn't recommend you learn LISP either. However, if you *did* learn LISP, you'd have a hell of a lot more fun doing it than you would learning C++. First big issue with LISP is you have to pay $$$ for a decent compiled LISP system. Second big issue is the syntax, but that's also its major benefit so try to hurdle this without looking down. Once you're over that you'll have a real, compiled programming metalanguage at your fingertips, and you'll be able to do anything.
Start with Paul Graham's book On Lisp which is available free online, then go and buy his Common Lisp book.
And yes, all commercial LISPs I know of have bindings to OpenGL.
Perhaps a few years ago nehe was a windows only shop, now for most of the tutorials they have several source downloads, SDL included!
Just skip any part of the tutorial text that mentions windows, and read your source of choice!
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?
.
Trolling is a art,
If I use Allegro for 2D graphics, 3D graphics, and input, then what do I use for sound? Allegro used to be able to output sound on Linux, but distributions that use PulseAudio broke Allegro because PulseAudio can't handle unsigned samples. Has this been fixed yet?
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
After you get a rendering context set up, you still need to load textures. This may differ per operating system unless you're using OpenGL with a cross-platform library like SDL_Image or Allegro.
Try www.openframeworks.cc
it's a bunch of libraries and wrappers for libraries for cross-platform development using C++ and openGL, primarily aimed at non-programmers. Most importantly it's a growing community of creative developers.
Memo.
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.
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.
Comment of the year
IMHO A framework can help out a lot, especially when your just getting started. A framework can help get you up and going rather quickly without having to worry about configuring everything. I'd recommend Qt. Here are some great examples: http://doc.trolltech.com/4.6/examples-opengl.html
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?
Mod up for srs luls... I lol'd
WTF Slashdot, why do I have to login 50 times to post?
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.
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
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
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
http://www.opengl.org/wiki/Tutorial:_OpenGL_3.1_The_First_Triangle_(C%2B%2B/Win)
Who is John Galt?
I recommend GLFW as an alternative to GLUT. It comes with some basic examples that are pretty decent and simple. GLFW is cross platform as well.
http://glfw.sourceforge.net/
I recommend you to use the SMFL library, which supports opengl and it's portable to many systems including linux, windows and osx. take a look at http://www.sfml-dev.org/ Good lucky!
C++ FAQ Lite
I used this site a bunch when I found myself doing some c++ work after almost exclusively working in java.
This is not the greatest sig in the world, no. This is just a tribute.
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), but there are several that are very good.
Good luck!
njord
Look for OpenGL ES 2 books and tutorials, e.g this one : http://opengles-book.com/index.html
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.
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?
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...)
Perhaps you've got something else on your ASS
or... most of the NeHe tutorials have various linux ports (Gtk, SDL, etc..) toward the bottom of the screen
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 :)
Why not just run it under Wine? When I only had Linux (not saying that's a bad thing) I had to continue work on my FPS through Wine. I just loaded up my IDE (Code::blocks) and did everything as if I was working in Windows. Worked great.
Why it's an absolutely seamless transition.
// current instance // The title bar text // The title bar text
// Initialize global strings
// Perform application initialization:
// Main message loop:
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];
// Foward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
MSG msg;
HACCEL hAccelTable;
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_XX, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}
hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_XX);
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return msg.wParam;
}
Bruce Eckel "Thinking in C++" Volumes 1 and 2. You can buy the softbound books or find them online for free. I suggest you develop using an IDE in linux, instead of the CL. Two popular C++ IDEs for Linux are Eclipse and my favorite Code||Blocks, which is a good option for anyone migrating from MS Visual C++
yeah so you should have your tutorials available as ready to go projects for every ide you may fancy to choose? nonsense.
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.
I'd start by downloading the full SDK here.
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.
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++ object-based wrapper.
Alternatively, you might look for existing OO wrappers for OpenGL; but the problem there will be that you're wedding yourself to that particular library/framework and whatever platforms it supports.
(I went through much the same process, but with Objective-C and OpenGL, 'cause C++ sucks and because my primary target was OS X.)
Then there's the third orthogonal issue of how to build Linux C++ binaries. My personal suggestion would be that until you have a compelling need for something more sophisticated, you go with a simple old-fashioned hand-written Makefile.
GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
The OpenGL Superbible is a great resource, if you're willing to buy it. It's how I got started.
Forget make...I know it's everywhere but it's a complicated dinosaur. As a C++ amateur I found SCons to simplify builds immensely. Plus, it's written in Python so your build scripts are just Python scripts.
Seriously. Install it now. Try the "Hello World" example and you'll be hooked.
http://www.videotutorialsrock.com/
This site was great for learning standard opengl concepts, complete with videos and code. Also, he covers glut, which I would highly recommend for simple mouse and keyboard polling in opengl.
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 problems with the linux-specific stuff, you should probably look for an X tutorial first, as most of the NeHe tutorials assume you already know how to do things like create a window.
Look for ogre3d then you can learn c++, opengl, directx, design patterns, cmake and ...
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.
Loading...
ironically i found this page from a google search...
epic sig..... ya i got nothing
http://www.nylxs.com/messages.html?id=539663&archive=2010-02-01
http://www.nylxs.com/docs/workshops/syntax.txt
I remember a couple of years ago trying to get some of those working in http://www.squidoo.com/womensera