Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Recommendations For C++/OpenGL Linux Tutorials?

timothy posted more than 4 years ago | from the no-you-guide-me dept.

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

cancel ×

117 comments

Sorry! There are no comments related to the filter you selected.

Have you tried this thing called 'Google'? (-1, Redundant)

Assmasher (456699) | more than 4 years ago | (#31581868)

http://nehe.gamedev.net/ [gamedev.net]

There are tons of places. Start with NeHe.

Re:Have you tried this thing called 'Google'? (1)

Rik Sweeney (471717) | more than 4 years ago | (#31581898)

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'? (4, Funny)

Assmasher (456699) | more than 4 years ago | (#31581930)

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:Have you tried this thing called 'Google'? (1)

isorox (205688) | more than 4 years ago | (#31583968)

Re:Have you tried this thing called 'Google'? (Score:5, Funny)
by Assmasher (456699) writes: ... 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.

Perhaps you've got something else on your mind

Re:Have you tried this thing called 'Google'? (1)

Jurily (900488) | more than 4 years ago | (#31585434)

Perhaps you've got something else on your ASS

Re:Have you tried this thing called 'Google'? (2, Interesting)

Assmasher (456699) | more than 4 years ago | (#31581902)

I forgot to add, the framework comes in Linux flavors. I have contributed to the Linux tutorials myself there.

Re:Have you tried this thing called 'Google'? (1)

HungryHobo (1314109) | more than 4 years ago | (#31582236)

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.

Re:Have you tried this thing called 'Google'? (1, Insightful)

Anonymous Coward | more than 4 years ago | (#31582760)

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.

Re:Have you tried this thing called 'Google'? (2, Insightful)

HungryHobo (1314109) | more than 4 years ago | (#31582816)

A tutorial which simply doesn't work is still a broken tutorial.

Re:Have you tried this thing called 'Google'? (1, Insightful)

Anonymous Coward | more than 4 years ago | (#31587412)

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.

Re:Have you tried this thing called 'Google'? (2, Funny)

grub (11606) | more than 4 years ago | (#31582946)


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:Have you tried this thing called 'Google'? (0, Offtopic)

Rasperin (1034758) | more than 4 years ago | (#31583588)

Mod up for srs luls... I lol'd

Re:Have you tried this thing called 'Google'? (1, Informative)

Anonymous Coward | more than 4 years ago | (#31581908)

You ever heard of reading the summary?

Re:Have you tried this thing called 'Google'? (2, Interesting)

stevenvi (779021) | more than 4 years ago | (#31581968)

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, but both can create a window for rendering OpenGL. I would personally suggest using the 4.9 series.)

Re:Have you tried this thing called 'Google'? (0, Redundant)

Assmasher (456699) | more than 4 years ago | (#31582056)

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'? (3, Informative)

NJRoadfan (1254248) | more than 4 years ago | (#31582186)

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/ [opengl.org]

Re:Have you tried this thing called 'Google'? (1)

TerranFury (726743) | more than 4 years ago | (#31582776)

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 [opengl.org] (GLUT is free but closed-source) if you'd prefer to use one of those. Although this tutorial [lighthouse3d.com] 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 [gamedev.net] .

Re:Have you tried this thing called 'Google'? (1)

3dr (169908) | more than 4 years ago | (#31583816)

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:Have you tried this thing called 'Google'? (0)

Anonymous Coward | more than 4 years ago | (#31584116)

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/

Re:Have you tried this thing called 'Google'? (1)

flablader (1258472) | more than 4 years ago | (#31584800)

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 (1)

tepples (727027) | more than 4 years ago | (#31583032)

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?

NeHe's good! (3, Informative)

Xetrov (267777) | more than 4 years ago | (#31581884)

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 :)

They are both platform agnostic. (4, Insightful)

ville (29367) | more than 4 years ago | (#31581888)

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

Re:They are both platform agnostic. (1, Informative)

Anonymous Coward | more than 4 years ago | (#31581980)

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:They are both platform agnostic. (2, Informative)

mdwh2 (535323) | more than 4 years ago | (#31582190)

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:They are both platform agnostic. (2, Insightful)

bastard01 (532616) | more than 4 years ago | (#31586718)

How about something from the 25th lesson? http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=25 [gamedev.net] The implementation of CreateGLWindow() is very windows specific, and from what I've looked at, there doesn't seem to be a tutorial for a Linux/X11 nor a SDL specific implementation, they do have GLUT for OS X and Solaris.. However, actually creating a window and polling for key input is very platform-specific with NeHe's tutorials, which may be why the OP was asking for tutorials specific to Linux.

Re:They are both platform agnostic. (0)

Anonymous Coward | more than 4 years ago | (#31586884)

Perhaps you need to read HIS comment?

Re:They are both platform agnostic. (0)

Anonymous Coward | more than 4 years ago | (#31585682)

Perhaps you need to go and read NeHe's tutorials. They are not at all Windows-based.

Re:They are both platform agnostic. (1)

mdwh2 (535323) | more than 4 years ago | (#31582002)

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:They are both platform agnostic. (0)

Anonymous Coward | more than 4 years ago | (#31582184)

Can't you see that they have Linux GLX/SDL versions of the code for each example? :P

Re:They are both platform agnostic. (1)

jellomizer (103300) | more than 4 years ago | (#31582256)

I didn't know windows c++ allowed you to run
#include

Re:They are both platform agnostic. (1, Informative)

Anonymous Coward | more than 4 years ago | (#31583586)

you can use < and > for smaller-then and greater-then signs in slashcode

Re:They are both platform agnostic. (1)

Zumbs (1241138) | more than 4 years ago | (#31582434)

But there are a few gotchas when playing around with OpenGL in Linux (using the Redbook). As an example: Which packages do you need to install? A few years back, I tried it out, and discovered (to my great annoyance) that the nVidia drivers for my graphics cards only came with with headers for OpenGL v 1.0, even though the card supported OpenGL 2.1. The open source alternatives only supported OpenGL 1.3, but had other problems.

Re:They are both platform agnostic. (2, Insightful)

hasdikarlsam (414514) | more than 4 years ago | (#31583084)

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:They are both platform agnostic. (0)

Anonymous Coward | more than 4 years ago | (#31582522)

Not sure how this got Modded Insightful. Should be modded +troll since its not helping, not providing insight, and generally just slaming someone who dared ask a question with specific's and provided details.

Re:They are both platform agnostic. (0)

Anonymous Coward | more than 4 years ago | (#31583096)

The point clearly went right over respondee's heads.

Are you under the impression you can compile a single cpp that has some OpenGL stuff in it and it will work independent of Window or Screen management?
Clue - it doesn't.

GLUT, SDL, etc abstract the window management for you - allowing for portable code.
Instead of accusing the asker of being ignorant of his own toolchain, consider the workflow of his goal.

Re:They are both platform agnostic. (2, Informative)

SupaSaru (1773854) | more than 4 years ago | (#31583314)

How did this get insightful? Worst comment ever. Do you think OpenGL just has magic platform agnostic Window management? Do you think OpenGL just takes over the whole PC as it's own little domain? Do you think the implementation between each OS is 100% exact? In fact, it's much closer to ignorantly assuming ^handles work "anywhere" because of C++'s "platform agnostic" title. The problem isn't in the tool chain - it's in the rather annoying process of creating rendering contexts for each individual OS - it has nothing to do with his chosen tool chain or "platform agnostic" title. SDL and GLUT alleviate most of the headache in this process.

Re:They are both platform agnostic. (0)

Anonymous Coward | more than 4 years ago | (#31584436)

Who cares that OpenGL and C++ are cross-platform. The poster wanted Linux information. Windows is a dead OS anyway and it's far better that he/she develops for Linux and better for all of us that programs run well on Linux and ignore Windows.

Re:They are both platform agnostic. (0)

Anonymous Coward | more than 4 years ago | (#31586476)

Because he's a freeject.

Re:They are both platform agnostic. (1)

StormReaver (59959) | more than 4 years ago | (#31586952)

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.

pls look (0)

Anonymous Coward | more than 4 years ago | (#31581890)

Most, when not all of NeHe's GL-tutorials have a Linux-port :)

They were ported... (0)

Anonymous Coward | more than 4 years ago | (#31581928)

Years ago.

It's OpenGL -- platform independent (1)

cerberusss (660701) | more than 4 years ago | (#31581938)

Since the question is specifically on OpenGL, I'd expect the tutorials to easily be converted to any other platform.

Re:It's OpenGL -- platform independent (0)

Anonymous Coward | more than 4 years ago | (#31582440)

I suspect what this is really about is how to use openGL with xlib which can be tricky. However if you google for "openGL xlib" you will find good results.

Another option is SDL of course, and there is plenty out there about that.

Or you can get an openGL window through GTK or Qt.

The rest should be cross platform. As for stuff being outdated, the only thing that has really changed lately is that display lists are being deprecated in favor of vertex buffer objects. It doesn't mean much in practice though.

Google it! (-1, Flamebait)

Anonymous Coward | more than 4 years ago | (#31581990)

Seriously, this get posted on the /. front page? Just fucking google it, moron!

Re:Google it! (1)

happy_place (632005) | more than 4 years ago | (#31582360)

...and thus we see why people hate developing for Linux...

Re:Google it! (-1, Flamebait)

Anonymous Coward | more than 4 years ago | (#31582966)

Wtf does his comment have to do with "developing for Linux?"

Moron.

LazyFoo might help (5, Informative)

Drethon (1445051) | more than 4 years ago | (#31582072)

LazyFoo's website http://www.lazyfoo.net/ [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.

SDL+OpenGL/3D Tutorials (1)

phorm (591458) | more than 4 years ago | (#31583464)

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:SDL+OpenGL/3D Tutorials (1)

Reapman (740286) | more than 4 years ago | (#31584940)

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 complex part, so far, to be font rendering. I ended up sticking with SDL's ttf library for that.

Although I don't consider myself even remotely an expert on any of this, since you seem to be where I was a few months ago if you have any questions feel free to ask.

All you're really looking for is one tutorial... (4, Informative)

llvllatrix (839969) | more than 4 years ago | (#31582076)

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

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:All you're really looking for is one tutorial.. (1)

tepples (727027) | more than 4 years ago | (#31583098)

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.

Re:All you're really looking for is one tutorial.. (0)

Anonymous Coward | more than 4 years ago | (#31585438)

or... most of the NeHe tutorials have various linux ports (Gtk, SDL, etc..) toward the bottom of the screen

Game engines (1)

bigpistol (1311191) | more than 4 years ago | (#31582126)

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.

choose a GUI (0)

Anonymous Coward | more than 4 years ago | (#31582128)

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.

Standard C++ books (5, Informative)

porsche911 (64841) | more than 4 years ago | (#31582234)

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:Standard C++ books (3, Interesting)

trurl7 (663880) | more than 4 years ago | (#31582426)

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

Re:Standard C++ books (1)

blue_teeth (83171) | more than 4 years ago | (#31584564)

May I add "Thinking in C++" by Bruce Eckel? It is available for free download from Bruce Eckel's site.

Re:Standard C++ books (1)

Dogbertius (1333565) | more than 4 years ago | (#31584392)

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:Standard C++ books (0)

Anonymous Coward | more than 4 years ago | (#31584546)

I do not recommend this books: except maybe the Stroustrup.
This books you can read in 1 or 2 years, because they are really great but not for the start (it didn't read the Koenigs, but maybe I should).
Principles and Practice Using C++ ( Stroustup ) is a good start, I think.

Re:Standard C++ books (1)

AuMatar (183847) | more than 4 years ago | (#31586668)

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:Standard C++ books (1)

porsche911 (64841) | more than 4 years ago | (#31588440)

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:Standard C++ books (1)

Xtifr (1323) | more than 4 years ago | (#31589060)

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.

Of course, Nutshell is even less suited to raw beginners, who have at least a chance of learning the language from Stroustrup. :)

Dead tree options. (1)

eoin_tbo (1485851) | more than 4 years ago | (#31582254)

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

NeHe, but Look further down the page (0)

Anonymous Coward | more than 4 years ago | (#31582312)

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.

The Red Book (0)

Anonymous Coward | more than 4 years ago | (#31582318)

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

Why not look at an existing game engine? (1)

i.r.id10t (595143) | more than 4 years ago | (#31582430)

Why not take a look at the code for an existing game engine like Quake (1/2/3) ?

Re:Why not look at an existing game engine? (2, Insightful)

Savage-Rabbit (308260) | more than 4 years ago | (#31582554)

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... (1)

stakovahflow (1660677) | more than 4 years ago | (#31582532)

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!

Serious programming (-1, Offtopic)

Anonymous Coward | more than 4 years ago | (#31582560)

If you ever get into serious programs (more than BASIC-like interpreted languages, of which Python is one example), you will do it on Windows. Just look at any high school programming class - Windows machines. Same for business, for military, manufacturing etc etc. Imagine getting a CS degree at a state university. You will probably work in Java on Windows 98.

Dear god no! (4, Informative)

Anonymous Coward | more than 4 years ago | (#31582678)

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. (1)

online-shopper (159186) | more than 4 years ago | (#31582690)

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 (3, Insightful)

e8johan (605347) | more than 4 years ago | (#31582728)

Re:Use Qt (1)

l_i_g_h_s_p_e_e_d (1773878) | more than 4 years ago | (#31583676)

Yes, the qt4 opengl blogpost looks like a good start. Qt even has a utility class to compile shaders for you.

C++ is hideous (0)

Anonymous Coward | more than 4 years ago | (#31582826)

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.

NeHe is windows based? (0)

Anonymous Coward | more than 4 years ago | (#31582838)

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 think you're really asking 2 different questions (4, Informative)

jimrthy (893116) | more than 4 years ago | (#31583062)

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 [parashift.com]

openframeworks! (0)

Anonymous Coward | more than 4 years ago | (#31583172)

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.

My grudge against NeHe (2, Informative)

Mabbo (1337229) | more than 4 years ago | (#31583212)

... is based on the book they (GameDev) wrote and recommend on their website, "Beginning OpenGL Game Programming, Second Edition". What a waste of my money. It doesn't teach you anything unless you already knew it. The code given on paper is in snippets, never full programs, and never fully explained. It was like they never actually had a beginner to OpenGL read the book before they published it.

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:My grudge against NeHe (1)

kazade84 (1078337) | more than 4 years ago | (#31585292)

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 book's official website at courseptr.com[1] and posted updates on NeHe explaining the problem. Later, when ATI updated their drivers and became more strict about an ambiguous part of the GL specification, I updated the project files again[2].

There are Linux versions of all the programs on the CD with project files for Code::Blocks, and the code compiles on both GCC and Visual C++ so I think it's a little unfair to say it was only for Visual Studio. Try out the updated project files, hopefully you'll have more success with them.

Regards,

Luke Benstead.

[1] http://www.delmarlearning.com/companions/content/159863528X/links/index.asp?isbn=159863528X [delmarlearning.com]
[2] http://www.kazade.co.uk/downloads/boglgp/bug-fixes-2009-08-29.zip [kazade.co.uk]

Two quick points (1)

Blakey Rat (99501) | more than 4 years ago | (#31583342)

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:Two quick points (1)

SupaSaru (1773854) | more than 4 years ago | (#31583486)

Hi! To go with point 1 - Can you "translate Windows C++" ? If so, you have the answer to a multibillion dollar portability question and the solution as to how to get Linux significantly into mainstream games and other entertainment. Go look into how to create a window in C++. Then look into how to create a window in GTK+. Tell me how good you are at instantly converting these samples while trying to understand how OpenGL contexts and rendering works.

Re:Two quick points (1)

jjohnson (62583) | more than 4 years ago | (#31584066)

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++ (1)

Script Cat (832717) | more than 4 years ago | (#31587064)

Why it's an absolutely seamless transition.
C++ is multi-platform.

#include "stdafx.h"
#include "resource.h"

#define MAX_LOADSTRING 100

// Global Variables:
HINSTANCE hInst;                                // current instance
TCHAR szTitle[MAX_LOADSTRING];                                // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING];                                // The title bar text

// 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;

    // Initialize global strings
    LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    LoadString(hInstance, IDC_XX, szWindowClass, MAX_LOADSTRING);
    MyRegisterClass(hInstance);

    // Perform application initialization:
    if (!InitInstance (hInstance, nCmdShow))
    {
        return FALSE;
    }

    hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_XX);

    // Main message loop:
    while (GetMessage(&msg, NULL, 0, 0))
    {
        if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }

    return msg.wParam;
}

Framework helps (1)

wesw02 (846056) | more than 4 years ago | (#31583422)

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 [trolltech.com]

GL version (1)

WilyCoder (736280) | more than 4 years ago | (#31583768)

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 (2, Informative)

bioglaze (767105) | more than 4 years ago | (#31584050)

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]

Skip some basic steps (1)

paulolellis (978554) | more than 4 years ago | (#31584128)

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/ [sfml-dev.org] Good lucky!

C++ FAQ Lite (1)

IsoRashi (556454) | more than 4 years ago | (#31584356)

C++ FAQ Lite [parashift.com]

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) (4, Informative)

njord (548740) | more than 4 years ago | (#31584532)

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

Good luck!
njord

NeHe is horribly outdated (1)

Syniurge (1550185) | more than 4 years ago | (#31584784)

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 (3, Interesting)

BerkeleyDude (827776) | more than 4 years ago | (#31584808)

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 [microsoft.com] (Yes, the irony is overwhelming...)

VTK (1, Interesting)

Anonymous Coward | more than 4 years ago | (#31586514)

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 :)

Use Wine (0)

Anonymous Coward | more than 4 years ago | (#31586878)

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.

recommended book and IDE (1)

CosaNostra Pizza Inc (1299163) | more than 4 years ago | (#31587178)

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++

Qt might be a good choice (1)

Urkki (668283) | more than 4 years ago | (#31587876)

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 (1)

metamatic (202216) | more than 4 years ago | (#31589130)

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.

Load More Comments
Slashdot Login

Need an Account?

Forgot your password?

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>