In which technology should I invest: DirectX or OpenGL?

Started by
34 comments, last by FrankWoo 15 years, 9 months ago
I use Visual C++ as my development tool. I want to learn a low level graphics technology. Can you give me the pros and cons of using DirectX or OpenGL?
Advertisement
Google would answer this, but what I did is flip a coin to decide what I learned first.
Here are the basics:

If you want to make games that work on other operating systems that aren't Windows, use OpenGL.

If you have Vista, and don't mind limiting your game to other Vista users, you can use DirectX 10.

Otherwise, it doesn't really matter. OpenGL and DirectX talk to the same hardware. They are two different ways of doing the same thing. Some people find OpenGL quite easy to start off with, because it has an easy to use "immediate mode". However, when it comes to serious rendering, you will not be using this mode.
This is a question that can't be answered easily. It is near-religious to be exact. The best way would be to check out both APIs (some code snippets, maybe some *good* tutorials ...) and then decide which API you like more.

Generally: You can't say XXX is faster than YYY. You can't say XXX is easier than YYY. You can't say XXX is better than YYY. You can only say that OpenGL is platform independent and DirectX is not. And you can say that DirectX is not only for 3D graphics and provides large and convenient helper libraries.

I personally prefer D3D thanks to its clear and mostly well-documented API.

Alexander
Thanks for your advice. I have googled it, and in fact seems to be a matter of personal choice. I will look at both to see which one looks prettier.
Quote:Original post by hiigaraCan you give me the pros and cons of using DirectX or OpenGL?

No, because these kind of conversations tend to generate more heat than light. Fortunately you don't need my opinion, because searching the forums will reveal that this has been discussed literally hundreds of times. So have a read and be enlightened [smile]
Quote:Original post by hiigara
Thanks for your advice. I have googled it, and in fact seems to be a matter of personal choice. I will look at both to see which one looks prettier.


If you use non-Windows platforms, the choice is made for you.
I don't use either, but based on what I've been reading and when I've dabbled in the past I would go for DirectX for the following reasons:


  • DirectX is near-as-dammit the absolute standard for Windows development. Seeing as most commercial games target Windows this seems to be a pretty profound requirement.

  • DirectX is continually being updated and improved, and has even been ported to two consoles (Xbox is derived from its original codename of DirectX-Box) and an MP3 player; the OpenGL crew have been bitching about OpenGL 3.0 forever now and OpenGL 2.0 is as old as the hills.

  • Further to the above, DirectX does appear in many places; the XNA framework Microsoft have issued for community-made Xbox 360 games is just a C# wrapper around DirectX

  • OpenGL only does graphics; DirectX includes much more than that (or at least it did, I'm behind the times)... it's like comparing apples and oranges. OpenGL does have addon libraries like GLUT but, again, these are as old as the hills and nobody really uses any of them commercially

  • You can use OpenGL with SDL, true. But it's pretty clumsy and all it enables you to do is easily create a window to draw in, all it saves you is the normal Win32 code required to spawn a window and draw to it in OpenGL mode

  • In my limited experience, I found DirectX much easier to use. It had better documentation, more resources available and better community support (although that's objective, the OpenGL community might claim otherwise)

  • Everyone will point you to the NeHe OpenGL tutorials; I don't want to sound rude but they really are useless, they're not put in context, they have limited comments and internal explanation and the code is pretty specific and geared to the specific demo he's showing you



I'm blinkered and only support Windows when I write code, so I would personally pick DirectX. If you're looking for a job in industry, though, knowing both or being in a position to learn the other after learning one would likely be beneficial to you, some really big studios write cross-platform games e.g. Unreal Tournament appears on Linux, and most iD games are OpenGL IIRC.

YMMV.
I personally prefer OpenGL because (as others has said) it is only a graphical API, not to mention I prefer to develop for multiple platforms.

Even though the current OpenGL is older it is the same as Direct3D (DX9) in terms of power and ability. About the only thing that is going to truly affect your decision is whether you wish to also develop for anything other than Windows or want to get into OpenGL ES.

What is more important than the API is the concepts that go into graphical programming. The API is merely how you communicate with the GPU.
------------George Gough
Quote:
You can use OpenGL with SDL, true. But it's pretty clumsy and all it enables you to do is easily create a window to draw in, all it saves you is the normal Win32 code required to spawn a window and draw to it in OpenGL mode


You seriously underestimate SDL if that is what you think. I certainly wouldn't describe it as clumsy. I find SDL to work fantastic complement to everything OpenGL doesn't do.

This topic is closed to new replies.

Advertisement