Sign in to follow this  
Ishaq

Should I learn DirectX or OpenGL? (No "never ending" debate intended)

Recommended Posts

Hi, I am a fan of open source (my machines runs linux most of the time), so I have a bias to OpenGL+SDL (on gcc) .but at the same time I find that Gaming Market is totally dominated by Windows and and it is biased towards DirectX (VC++ 6.0). Moreover, most of the books that address openGL, do it from a windows context (VC++ 6.0 and etc etc). Please suggest me something. (I have been browsing the internet for a couple of days and am quiet confused about which way to go) Also note that I don't just want to learn it as a hobby, I want to able able to persue a professional career in game development. I hope this thread won't become another never ending debate, since I am quiet aware that both DirectX and OpenGL have pros and cons. it's just that I can't make and decision and stick to it. (I start reading DirectX and think "OpenGL is good" and vice versa) Regards, MI

Share this post


Link to post
Share on other sites
VC++ 6.0 is 9 years old. It is ancient. Further, you can use OpenGL and SDL from Visual Studio just fine (including the modern VS2005 which is vastly preferable to VS6). I've done it myself. What little DirectX "bias" there is that is not just the figments of somebody's imagination is of little consequence -- both OpenGL and DirectX are doing just fine in professional game development.

If you're using Linux most of the time, I'd go for OpenGL. This was the tiebreaker for my own choice between the two graphics APIs. Last I checked, it just wasn't worth the hassle to get DirectX games running under Wine, nevermind trying to develop DirectX games on Linux with Wine.

Regardless of your choice, pick one and stick with it. Really. "Better" is subjective, hard to measure, able to change on a whim, and in the end, completely inconsequential. They're close enough together that the gains of using whichever is "better" are outweighed by the gains of just picking either one and persisting with it. Experience counts more than tool choice here.


MaulingMonkey cues today's ____ versus ____ battle

Share this post


Link to post
Share on other sites
Hi,

Thanks MualingMonkey, When I say VC++ 6.0, I actually mean Microsoft IDEs (as of there is nothing else left in the world besides MS for GameDev).

About the choice of "better", I totally agree with you...

But how to get over that feeling of "I'm wasting my time with this, DirectX is fast" and "I am wasting my time with this, openGL is standard", :)

I am still at square 1, do I need to toss? ;)

Regards,
MI

Share this post


Link to post
Share on other sites
Personally I started learning OpenGL. But really it's up to you. If you can't make up your mind I'd go OpenGL. If there is a chance you might want to develop on anything other then Windows I'd go OpenGL. If you specifically want to go highly indepth into gaming as fast as you can I'd go DirectX.

I personally think OpenGL is good place to start. But really either way is fine. But as monkey said, pick one and stick with it.

Share this post


Link to post
Share on other sites
My personal preference is DX. I prefer DX mainly because they're not afraid to change the API, so when new features appear instead of trying to add them in to what already exists, they redesign so it fits in better. As a result I prefer to use D3D over GL as I find the API more coherrent. Of course a changing API can be very annoying when you have a large codebase using DX, but I don't so it doesn't bother me. GL does have the advantage that when new features come out vendor specific extensions can allow you instant access to them, while in D3D you may need to wait for a new D3D revision.

I do think you should eventually know both APIs, once you've learnt one picking up the other is pretty simple, the concepts are all the same (I personally learnt GL first, I then picked D3D up pretty quickly by simply reading through the docs and writing some code).

If your prefered environment is linux then GL would be the obvious choice, if you do want to use DX you'll probably want to use VC++ as well, you can use DX with other compilers on windows however getting all the includes and libraries working with another compiler may prove tricky, so if you want to avoid VC++ (even if you do want to do your work on Windows) GL may be the better choice.

Share this post


Link to post
Share on other sites
Personally prefer directX, but my preference has nothing to do with it's ability. I like the feel of it, the way it works, and the way it's structured. The two API's are as close to functionally equal as most would care to measure [minor differences, but generally speaking, anything you can do with one can be done with the other]. Experience with both would be ideal, but for learning purposes, you really should read through each of them a bit, and choose one that you feel comfortable working with. The amount of your code that actually deals with either of these libraries is likely going to be isolated in a rather small sliver of your code anyway, so if you really decide that the other option is better, it's not so bad to convert.

The theory portion of graphics though is API independant, and the skill you pick up in one can be carried over.

Share this post


Link to post
Share on other sites
While you claim that the gd industry is "biased" towards DirectX and MS specific development tools, it is you who seems biased towards Linux (you said it yourself). I suggest you do some research before making these claims. DirectX doesn't beat OpenGL or vice versa. They are both equal in power and speed and if developing under Linux is your thing, then OpenGL is the probably the best option.

NOTES:
1) OpenGL is _not_ open source, it's an open standard.
2) DirectX and OpenGL are equally fast on the same hardware, period.
3) The game market is what it is, a market. It revolves around money. Developing for Windows and/or the Xbox has its advantages. With DirectX, you kill two birds with one stone, saving valuable time and increasing revenues. The same goes for OpenGL. The Playstation 3 for example, uses a custom version of OpenGL|ES.
4) You can download VS2005 Express for free from the MS site. They're not (that) evil contrary to popular believe. Even the entire MSDN library is free of charge.
5) OpenGL is not unpopular by any means. In fact, most DirectX 10 functionality is already available as an extension set in current OpenGL drivers, without the need for Vista and new architectures/games are on the way (ET:QW).
6) Probably most important: there are tons of tutorials on seting up OpenGL using SDL under Linux/gcc or other combinations of OS and compiler.

EDIT: In short: knowing one API will give you an edge learning the other, but my best bet would be to start with OpenGL. (changed a few points)

Cheers :-)

[Edited by - Todo on June 1, 2007 5:26:26 AM]

Share this post


Link to post
Share on other sites
For a typical Windows-based beginner, I would suggest starting with DirectX using C#, because of the very nice library-language integration, and the fact that DirectX can be installed very simply on the free Visual Studio 2005.

On the other hand, since you run Linux, then you can probably set up an OGL development environment using your package manager of choice faster than you could migrate to VS2005, so I would say to go for SDL+OpenGL.

Ultimately, if you don't know both DirectX and OpenGL, or if you are not able to learn them in less than a week when required to, you have no business working in professional 3D game development anyway.

Share this post


Link to post
Share on other sites
Hi,

@Todo: Thanks friend, yup, I am a little biased towards linux as I admitted in my first post. and No, I am not against MS, I didn't write those lines against MS meaning something bad. Yup! I know openGL is open standard (not open source).

@ToohrVyk: Thanks for the straight forwardness, I agree with your "no business" line ;), The only trouble was deciding on something to start, and I should quickly decide on something to save myself more embarrassment :).

Okay, DX and VS it is, please suggest me some good book to start with. and No, please don't suggest me DirectX with C#, since C# is a managed language and I know pro's don't program games in C#.

Regards,
MI

Share this post


Link to post
Share on other sites
Quote:
Okay, DX and VS it is, please suggest me some good book to start with. and No, please don't suggest me DirectX with C#, since C# is a managed language and I know pro's don't program games in C#.


Oh boy, this just started another never ending debate.

To put it simply - all performance you'll ever need comes from DirectX itself and the hardware. The language you use is very secondary.

If you want to go pro, you'll need both, C# and C++, and DX and OpenGL. And many more. By the time you're pro, both of those will change, so will DX and OpenGL. By at least 2 versions. And in 5 years, at least one new language is bound to come out. A good aproach would be also to write a 3D renderer yourself, to learn how things work.

To turn pro, university is just about the only way. Going pro means not learning an API or a language, but understanding the problems behind actual development. Without that, no knowledge of API will help you. Going pro will take you several years, 3-8, before you're comfortable enough with all aspects. So it doesn't matter what you choose, just get studying and coding.

Share this post


Link to post
Share on other sites
Off topic: C# ain't that bad. I don't mind it at all, it can slow things up a little but can be a nice language to start with as you have less time to worry about your code and more time to spend on DirectX.

Yes Antheus I agree, university is one of the better ways to go about it. Or some form of school never the less. And yes it's less about which one you start learning more that you actually learn one.

Pick whatever you think will be best, maybe even grab a couple of OpenGL and DirectX sample programs, and whichever one you like the looks of start there. That's how I started, found a good OpenGL sample and thought "that looks easy" and slowly extended it to do what I want.

Have fun!!!

Share this post


Link to post
Share on other sites
Point Noted. Yes, I know that it would be a long learning curve... unfortunately there are no universities here that offer such courses. (I only had a Computer Graphics Course in my university last year which only touched the surface.)

If you say I should write a 3D renderer myself, would you please suggest some good reads (I have some experience of C/C++, so language is not an issue...)

Regards,
MI

Share this post


Link to post
Share on other sites
"Fundamentals of Computer Graphics, 2nd Ed."

Computer graphics is not usually a subject for undergraduate courses beyond a rather superficial level (if that). It's something you'll likely need to study extensively on your own; although the other aspects of a college education that are not graphics-specific are rather critical to becoming competent enough to apply for a professional entry-level job (as other have noted, the fundamentals about how and why things work, not just trivial API details).

Share this post


Link to post
Share on other sites
Heh , im confused too..

Really , i dont know where to go after SDL(i've made few mini-games only..)..
I've tried to learn OPENGL in the past, but i FAILLED, YES I FAILLED, and it SUCKS(have you ever failled in 3d programming? if yes , i guess you DO UNDERSTAND how i feel).

I plan to start learning DirectX , just because it looks different.
What do you guys think about my choise?

Also , can you recommend some books?
What im looking for , is :

-A book for C++(something advanced)
-A book about DirectX (something really cool)
-3D Maths &DirectX (geometry/algebra etc..)

Oh , and , yes , i know that there's a great tutorial here:
www.dxtutorial.com , but that's , just not enough...
PLEASE help , im serious , i have a feeling that this time I WONT FAIL(you can laugh ...but I dont care -_-)..

Share this post


Link to post
Share on other sites
Quote:

-A book for C++(something advanced)

Too general a question. Have you read Thinking in C++ and C++: A Dialog (both online books)? Have you read Modern C++ Design (a paper book)? Provide some kind of context about what you mean by "advanced."

Quote:

-A book about DirectX (something really cool)
-3D Maths &DirectX (geometry/algebra etc..)

The DirectX SDK documentation is better and more complete than any book you will find on the subject. You should generally tend to avoid books about specific APIs, because they depreciate in value quickly as the API they are written to evolves -- they become out of date. Instead, prefer books on the fundamental concepts (like the book I linked in a previous post) and use the API reference to learn how that API implements those concepts.

For math, I like "The Geometry Toolbox" and "Essential Math for Games and Interactive Applications" and "Visualizing Quaternions." The last is obviously rather focused.

Share this post


Link to post
Share on other sites
I can't say I've delved into the deeper aspects of OpenGL or DirectX (that is, heavy-hitting rendering with extreme optimization). I have worked with both, however, and in my experience, OpenGL is easier to learn. The learning path for DirectX is somewhat convoluted.

However, DirectX can do most things OpenGL can (my OpenGL code can peak ahead in the texture pipeline, I haven't figured out how to get DirectX to do that, but I haven't started working with shaders yet), and once you get the hang of 3D rendering, you may find that DirectX implementations may offer some card-specific optimizations that aren't available in OpenGL for the same card, and vice versa.

For my part, I would recommend OpenGL to beginners.

Share this post


Link to post
Share on other sites
I tend to agree that going OpenGL together with SDL (or even GLUT) would be better to at least start with, mostly because DX intertwines with the Windows API: if you already know the Windows API this is a good thing, if you do not know the Windows API then this can be a bad thing... if you start with OpenGL I recommend the following support libraries as well:

1) SDL (for initializing the screen and getting user events)
2) SDL_image (to load images)
3) boost (assuming you are using C++)

the need for SDL_image comes from the painful fact that OpenGL by itself has no image loading functions (which makes sense for OpenGL since it is a graphics API and nothing else), but can be a pain when you want to load images for texturing.

and naturally, by using OpenGL+SDL you are not tied to Windows and can (mostly) write the same stuff for Mac, Linux, Windows, and whatever else...

one painful part about OpenGL is that at times the driver quality is not as high/accurate as one would like (typically ATI has more issues) but I've had issues with nVidia's as well (the newer drivers {Linux and Windows} screw up clip planes when used with shaders)

if you go with DX, you are tied to Windows (and Vista if you go DX10) but that gives you all the Windows API (which depending on one's point of view is a good or bad thing) and all the docs online from MS (i.e msdn2) where as the OpenGL docs are not as centralized... if you start to learn openGL, you cannot go wrong with the the OpenGL "Red Book", there are older version available online for free and it is an excellent text (mostly) to start with....

Share this post


Link to post
Share on other sites
Quote:
Original post by jpetrie
Computer graphics is not usually a subject for undergraduate courses beyond a rather superficial level (if that). It's something you'll likely need to study extensively on your own; although the other aspects of a college education that are not graphics-specific are rather critical to becoming competent enough to apply for a professional entry-level job (as other have noted, the fundamentals about how and why things work, not just trivial API details).


Have to disagree, but it depends on what you mean by superficial level. I have no university experience of DX or OpenGL (they didn't have any courses for them) but 3rd year of my undergrade IT course at uni I did have to design a software 3D graphics engine in which we designed a game to show it's features. We started from "here is a pointer to the frame" from then we had to learn how to set the RGB values all the way to gouraud shading. Best subject I have done!

Share this post


Link to post
Share on other sites
***lol..
i lost it again...
***

So , you guys think that , in my case , its much better to learn opengl?
I have some experience with sdl , also i've used opengl for a while , but i gave up.

If i start making 2d mini games (without graphics , just vertices) first , you think that will help?
or i'll just waste my time??

@jpetrie:
I really dont know what book to buy(about c++) ...im looking for something uh...uhmm..

If that helps , im a ....
lol..
novice -> pro wannabe :)...


By the way , "Visualizing Quaternions" is focused on DirectX?

@kRogue:
This(http://www.glprogramming.com/red/) is the red book that you're talking about?



Share this post


Link to post
Share on other sites
Quote:

By the way , "Visualizing Quaternions" is focused on DirectX?

No, its focused on quaternions.

Quote:

Have to disagree, but it depends on what you mean by superficial level.

Disagree if you like, but you'd be wrong. If you take the time (I don't recommend it, it's boring) to examine the CS curricula of large enough sample of institutions offering undergraduate degrees, and then throw away the classes that are called "computer graphics" but are focused more on modelling or 2D imagery, you'll be left with a handful of courses... on average around one per school... that dealt with computer graphics. Many of those courses, you'll find upon closer examination, tend to be API-focused or survey courses.

This excludes courses that are really graduate courses, regardless of whether or not undergraduate students can take those classes.

Universities known for their advances in graphics research tend to have more undergraduate graphics courses, as you'd expect.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this