guide about game programming

Pages: 12
hello friends,

I'm beginner in game programming and confused about platform
which one is best ....

1. DirectX
2. OpenGL


and tell me best books where i learn easily
Hard to say. Depends on taste I guess...
see http://en.wikipedia.org/wiki/Comparison_of_OpenGL_and_Direct3D
Directx is is for microsoft while opengl is cross-platform. I would go with opengl here is some good tutorial's for it.
http://nehe.gamedev.net/
Vidus +1
good tutorial's

I strongly disagree: http://cplusplus.com/forum/general/21228/#msg111195
chrisname, tell me, what exactly leaded you to an assumption that this code should be cross-platform? It is rather hard to write a cross-platform code when you decide to use windows API to create windows, etc.
That's the point. Why bother using a cross-platform library when you're using the windows API? Just use directx if you're going to use platform dependent code!

what exactly leaded you to an assumption that this code should be cross-platform

All code should strive to be portable where appropriate.

It is rather hard to write a cross-platform code when you decide to use windows API to create windows

Then... don't? Use GLUT. It takes care of that for you.

My problem with that tutorial is the lack of thought that went into portability. The guy even used backslashes in his include paths. It just shows how little the author thought about people trying to read his tutorial from a non-windows system.
Last edited on
chrisname why do you say that, Is it because nehe uses #include <windows.h>? if that's why i was just directing him to them because it has good tutorials on using opengl.You can take what you learned about opengl from there and use a different gui api such as glut like you said or wxWidgets,Qt,FLTK or any of the many other cross-platform gui api's.
Last edited on
The nehe tutorials are not perfect -- they are written by a variety of people and include some mistakes in organization and syntax. You can easily see the differences in code quality among the user-submitted translations to various languages.

But they are about OpenGL, not perfect C or C++. And as OpenGL tutorials, they are pretty good.
I've already explained why I don't like those tutorials. It's not because he used windows API -- I've used it a few times (with conditional compilation). It's because he made his code unportable by making it completely dependant on the windows API. He even made the preprocessor directives platform dependant. That's why I think he's an idiot.
I've already explained why I don't like those tutorials. It's not because he used windows API -- I've used it a few times (with conditional compilation). It's because he made his code unportable by making it completely dependant on the windows API. He even made the preprocessor directives platform dependant. That's why I think he's an idiot.


Not all people care about cross platform code.

Sorry chrisname, but if this is your only reason to call him an idiot, its a pretty weak reason. I use "#pragma once" all the time when compiling in windows, just because it looks so much cleaner than the typical #include-fence. Am I an idiot too? Using backslashes in includes may be "just easier to copy'n'paste from your favourite file manager." Would be reason enough for me, if I don't have to look at cross-platform issues. And the part in question is even under the "Windows" - part of his tutorial!


(I haven't read the whole tutorial. There may or may not be other issues with it. I just want to say, that I don't like people calling people idiots just because they write backslashes in includes or don't surround all mentions of "windows.h" with ifdefs when they write windows-tutorials).

Ciao, Imi.
Not all people care about cross platform code.


They should.

I share chrisname's frustration at the "I only use Windows so that's the only platform I should care about" mentality that is commonplace among many development circles.

There are plenty of very good reasons to not write crossplatform code. Being too lazy/careless to write "/" instead of "\" isn't one of them.

OpenGL is a crossplatform lib. So it makes sense that you would use crossplatform code when working with it unless you have reason not to.

The tutorials in question probably have little/no reason.

While I wouldn't go so far as to call these programmers "idiots". I would recommend they improve their practices. Especially if they're taking up writing tutorials. Spreading bad practice in a tutorial is more dangerous than a lot of people think.
Thank you Disch.

"just easier to copy'n'paste from your favourite file manager."

If you're using include paths like
#include "C:\Program Files\Some Compiler\Include\GL\gl.h"
you're doing it wrong.

While I wouldn't go so far as to call these programmers "idiots". I would recommend they improve their practices. Especially if they're taking up writing tutorials.

I wouldn't call them idiots if they weren't writing it on a tutorial.

Spreading bad practice in a tutorial is more dangerous than a lot of people think.

This is why I think they're idiots.
They should.


I would hardly think it appropriate to tell somebody how to do something they do on their free time with no compensation whatsoever. If this were a book sold for profit (or for profit learning website), your complaints would be perfectly valid.

As it is, free tutorials in general are tough to find. You get what you pay for. If you aren't willing to pay anything for it, then don't bitch about what you get.

Spreading bad practice in a tutorial is more dangerous than a lot of people think.


Dangerous in what way? I fail to see any real danger in it at all.
closed account (z05DSL3A)
chrisname, why not write a cross platform OpenGL tutorial and post it in the Articles section? (http://www.cplusplus.com/articles/ )
I would hardly think it appropriate to tell somebody how to do something they do on their free time with no compensation whatsoever.


As someone who regularly contributes to tutorial writings, online forum postings, code snippits, etc with no monetary compensation, I have to strongly disagree.

Own up to your work. Saying "well I did it for free" isn't a free pass to do a sloppy job.

It may seem like a noble gesture to do community service... but if all you're doing is slowing down/hindering the process, you just frustrate everyone else who's trying to do the same community service (not to mention making it harder on the people receiving the service).

Going as far as to insult someone because you don't like the way their tutorial is written is too far, though, I agree.

I'd much rather have someone tell me my work is wrong and/or could be improved than have them slander me behind my back.

It's not like this person is maliciously spreading bad practice, he just doesn't know any better. The only way he can know better is if someone tells him.

@ chrisname: if this really bothers you that much, write to the tutorial author and recommend changes. But keep a civil tone when you do so. You catch more flies with honey, etc.

But I wouldn't hold out hope for a tutorial update. He may have lost interest and/or may not be available to contact.

As it is, free tutorials in general are tough to find.


I never said he shouldn't write tutorials. I said he should do a better job of writing them. I suppose this is a "take what you can get" situation, but that's kind of the problem. When "what you can get" is bad examples, that's a problem that should be addressed.

Dangerous in what way? I fail to see any real danger in it at all.


Misinformation in an authoritative tone is harmful because it gives someone the impression they're doing things correctly, when in fact they're doing things all wrong.

What's more, when a coder who has more insight and/or better code comes along and tries to correct the reader or show the reader better practice, he's met with skepticism because the reader will fall back to "well the tutorial said to do it THIS way, I don't see why I should change".

The coder could give a long list of reasons to the reader why he should change his practies, but because he doesn't seem as "official" as a tutorial, it might fall on deaf ears.

So a bad tutorial not only can steer people in all the wrong direction, but it can also make it harder for them to find the right direction, AND can frustrate other people who are looking to help.
Well, for me the conclusion is, that when someone ask me the question: "OpenGL or DirectX", my answer will include: "If you choose OpenGL, be aware that you have a lot of senseless discussions with platform zealots about 'that's not portable' - non-issues." :-P


Ciao, Imi.
Disch wrote:
keep a civil tone

Good advice. Thanks. I guess it was a little far :)

Grey Wolf wrote:
chrisname, why not write a cross platform OpenGL tutorial and post it in the Articles section?

I think you're being sarcastic, but I think I'll humour you... then you guys can help me improve it and we'll have the best OpenGL article on the Internet :)
Last edited on
closed account (z05DSL3A)
chrisname wrote:
I think you're being sarcastic, ...

It was only partly sarcastic. I believe in the Idiom: Walk a mile in their shoes. If you want to call someone an idiot for doing something, do better before you do. (horrible over use of the word 'do' but...)

It would be good to have some well written tutorials on this site for some of the things that get recommended.
well a really good book(s) to lean directx is by an arthur name frank luna. search him on amazon , his books are rather cheap and easy to understand. he has really good code, tutorials, and sample code. all in c++
Pages: 12