DirectX vs OpenGL ?

Started by
39 comments, last by 21st Century Moose 12 years, 7 months ago
Hello!
I read about DirectX and OpenGL and which one is the best to use for what and which one is bad at what..

All i found was that OpenGL is cross-platform and its easier to code with it.. But is this realy true or can some one please provide me with a better website where i can read about it ? Or something,

Thanks!
Advertisement
Previous threads here

GL works on Linux/Mac/Windows
GLES works on mobile devices and browsers
DX9 works on Windows XP/Vista/7
DX11 works on Windows Vista/7

GL has 4 main versions --
* GL1 is the basic stuff that the majority of tutorials will cover. This is old and deprecated, but can still be used as an introduction to graphics programming.
* GL2 is the equivalent to DX9. It adds shaders and other 'modern' features.
* GL3/GL4 are the modern versions, equivalent to DX10/11.

GLES has 2 main versions -- one for older mobiles, and one for newer mobiles with more modern features.

D3D has 3 main versions at the moment --
* DX9 is only used if you need to support Windows XP.
* DX10 has been superseded by DX11, and isn't required any more.
* DX11 is the current gold standard for graphics APIs, but only works on Vista/Win7.
Thank you for this great information!

I read about DirectX and OpenGL and which one is the best to use for what and which one is bad at what..

Actually, the real question is what you are good and bad at. They're both graphical APIs (well, D3D is, which is a part of DirectX), and you can do cool stuff in both of them. The only time it'll ever make a difference is if you have the knowledge and ability to take either API to its limits. Which, at your current state, you can't do... yet. So pick one and learn it. Don't be afraid of picking the wrong one. There isn't necessarily a "wrong" choice. And the best programmers will know both, so if you plan on continuing to progress you'll probably learn a bit of both anyway.


All i found was that OpenGL is cross-platform

Yes, it is.


its easier to code with it.

Not necessarily. I've heard plenty say DirectX is easier, and plenty say OpenGL is easier.


But is this realy true or can some one please provide me with a better website where i can read about it ? Or something,

If your programs are going to run on just Windows, my honest suggestion is putting two peices of paper on a dart board, one labeled "DirectX" and one labeled "OpenGL", and throwing darts until you hit one, and then just go with that one.

My one precaution is that there's a lot of outdated documentation and tutorials for OpenGL (i.e. NeHe's tutorials are waaaaaaay outdated). So make sure that whichever you go with, you stick with current and relevant documentation and tutorials.

[edit]

Blasted Hodgman, would you slow down for a minute!?! The last couple of threads I've replied to, there's been no one who's replied when I start to reply, but by the time I hit the "Post" button, you've already claimed the glory of first reply and managed to get the OP to reply as well! I give you the award of Uber Ninja.
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
OpenGL is a cross-platform graphics API. It only does graphics. It is easier to initialize than DirectX, but I don't think it's significantly easier or more difficult to use. I haven't looked at it in a while, so I'm not the guy to give you many specifics. Also, you'll need other libraries if you want sound or game-controller support.

DirectX is Windows-only, and has APIs for sound and input as well as graphics. It's a bit more complicated to set up, but not severely so. If you're targeting WinXP then you're limited to DirectX 9; if you're not targeting XP then look at DirectX 11. DirectX 9 still has a fixed-function pipeline, which makes it easier to get into than DirectX 11's shader-only model, but so much has changed between the two versions that learning DX 9 has limited benefits if you're more forward-looking.
Thanks, im sure i will have use for all of theese ideas!
just pick whichever one your more comfitible with.
from what ive read and checked out, there is no "real" difference between the two, other OpenGL does not care weather your running XP/Vista/Win7 it wont cut you off from features if your card supports it.

Never say Never, Because Never comes too soon. - ryan20fun

Disclaimer: Each post of mine is intended as an attempt of helping and/or bringing some meaningfull insight to the topic at hand. Due to my nature, my good intentions will not always be plainly visible. I apologise in advance and assure you I mean no harm and do not intend to insult anyone.

Choosing between DirectX or OpenGL is largely pragmatic. "Knowing" how to use a given API is purely semantics so don't get bogged down with "is x better than y", especially at this stage.
I (subjective opinion!) would definitively say yes, OpenGL is easier and better to read than DirectX.

Take a look at a DirectX "Hello World" and OpenGL "Hello World". You will be able to read the OpenGL-code at once, but with DirectX you will first think of "wth? What's LPWSTR? pd3dDevice? SRV? Why aren't there any self-documenting names?". (at least that's what I thought of my first DirectX tutorial)

And it's getting even worse if you what to find a very uncommon functionality in the msdn documentation AND understand it. - good luck!
Well, OpenGL hasn't a super-good documentation either, but most function-names (I had to use) are self-explaining.

If you want to use DirectX, Program on Windows or if you like Visual Studio then ok. If you don't care I would use OpenGL.
But take a look at a Hello World Example of both before you make a decision! ;)

I (subjective opinion!) would definitively say yes, OpenGL is easier and better to read than DirectX.

Take a look at a DirectX "Hello World" and OpenGL "Hello World". You will be able to read the OpenGL-code at once, but with DirectX you will first think of "wth? What's LPWSTR? pd3dDevice? SRV? Why aren't there any self-documenting names?". (at least that's what I thought of my first DirectX tutorial)

And it's getting even worse if you what to find a very uncommon functionality in the msdn documentation AND understand it. - good luck!
Well, OpenGL hasn't a super-good documentation either, but most function-names (I had to use) are self-explaining.

If you want to use DirectX, Program on Windows or if you like Visual Studio then ok. If you don't care I would use OpenGL.
But take a look at a Hello World Example of both before you make a decision! ;)


While you are thinking about that, keep in mind that DirectX is built using "simple" COM. Whether you believe that is a good thing or not, a capable Windows programmer should have a good understanding of the naming conventions found within the API.

This topic is closed to new replies.

Advertisement