Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 525
  • Last Modified:

Why to choose DirectX or OpenGL?


I'm just starting to learn some programming languages; I've started with C and actually I'm in C++, and I'm planning to move on a graphics language, such as DirectX or OpenGL. But I don't know their differences, don't know why to choose one or another.

Thanks in advance, I'll be waiting for your replies
1 Solution
Their similarities are bigger than their differences. DX has a strong support from MS and openGL from the open source community.

If you only program for windows I would probably choose DX. Otherwise openGL is the obvious choice.

There is not a real answer to this question so I am not expecting 80 points for this one :)
DirectX is Microsoft-specific, meaning it will work only on Microsoft platforms, and OpenGL is cross-platform, portable to a number of different systems.  Both have strong support and extensive documentation and both accomplish essentially the same things.  DirectX uses COM interfaces, which organize it but also complicate it somewhat (there are half a bajillion different interfaces and classes and methods to remember); OpenGL is somewhat simpler, using a set of functions and data types to do the same things.  I would agree with jachimc that for Windows DirectX seems best and otherwise OpenGL.
Basically DirectX is more windows dependant, but offers more features as far as sound and graphics.  If you plan on doing anything strictly windows go with this.

For everything else, there's OpenGL, it's open source as the other guys said, so it offers more flexability at the expense of a few bells and whistles.
MrSotomonteAuthor Commented:
Well, thanks for your replies, I've found them all useful.

I think I've posted this on the wrong section and I've spend too much points on this ambiguous question as I'm new on the community, but from now on I'll try to do it OK.

I'll be posting more questions soon as I get more points :)

Thanks again
I think that the main issues have been asked. I can only add a few considerations. I don't think there is a 'wrong' choice.
-Some cards will run games at very different speeds depending on the choice of OpenGL or DirectX.
EG On a Voodoo2 state changes were very cheap in OpenGl, but very expensive in DirectX.
The way that you use each will affect the speed and you won't be able to just 'replace function names' and use your old engine to change from one to the other.
Coding style
-I have heard that OpenGL is 'more elegant' than DirectX, and from my experience DirectX is a little bit of a mess, however once you have worked out your basic setup you will forget most of that pain.
-Future of your program.
Do you want to port your code to a non-MS OS (choose openGL) or maybe the Xbox (DirectX)?

Frmm my knowledge of DirectX (some programming) and OpenGL (theorectical, read a few books) you wouldn't be wrong choosing either. The theory is practically the same and if I were looking for a good DirectX coder I think I'd be better off getting someone with good OpenGl experience and helping them rather than getting an inexperienced DirectX coder, if you see what I mean.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now