PDA

View Full Version : OpenGL vs DirectX



EVOEx
04-11-2009, 04:24 AM
I think it's time for a flamewar - erm discussion between OpenGL and DirectX.

Myself, I only do OpenGL. This has mostly to do with the portability (the fact that I only code in Linux may have something to do with it ;-) and I really dislike Microsoft. While I've used DirectX many years ago, I think they're pretty much the same thing and technically, I have no idea what the upsides or downsides of both are.

But like I said, for me, portability is most important. So I'll always stick to OpenGL ;-).


So what do you guys think?

BuzzBuzz
04-11-2009, 05:07 AM
I'm not at the level to actually program in either yet, but from an experience point of view of both platforms in terms of gaming OpenGL based games have always been better than directx as far as I'm concerned.

It could be that there are more skilled OpenGL programmers rather than it being a better platform though. Until we get some input from OpenGL/directx gurus we won't know if that is true or not....

Shakti
04-11-2009, 01:19 PM
I think you need to search.

Seriously, this has been debated, debated, flamed and then debated some more on these boards.

These threads serves no purpose and IMO are completely useless since they all end up with pretty much the same conclusion.

And to say OpenGL games are better is purely subjective, and holds no merit whatsoever. That together with the fact that the same game could be written using DirectX shows that neither is better than the other. This coming from a guy who programs OpenGL but I also realize that both have their uses and what you choose is more a matter of what you are familiar with and depends on each projects goal rather than a limitation within the API.

VirtualAce
04-11-2009, 02:23 PM
I say use what works for you.
This is being moved to the GD forum.

MK27
04-11-2009, 03:02 PM
Please don't feed the trolls.


Spoil sport!

Yarin
04-14-2009, 02:29 PM
Making another GL vs DX flamewar thread is worse than re-inventing the wheel.

When it comes down to it - they both to the same things to the same hardware. One isn't "better" than the other. But I do like GL better because it's easier to impliment (I may be saying this simply cause I learned it before DX, though I'm not very expericenced with either), it's alot more compact (while DX needs a huge distro package, GL has a few small DLLs at most), and it's cross-platform. I honestly don't know why anyone still uses DX, I mean, you get the same stuff as with GL, only with alot more headache.

Yarin
04-14-2009, 02:33 PM
Also, OpenGL and DirectX aren't comparable. DirectX does more than draw 3D, it has a lot of other game dev stuff. Direct3D is the target here.

Akkernight
04-15-2009, 10:49 AM
Yarin, and I don't understand how anyone can program in OpenGL...

I've been in such 'wars' so often, I'm getting tired of them, still I feel a need to join each one of them xP

If you search on Wikipedia for DirectX vs. OpenGL, you'll see that it says clearly - DirectX is better for games while OpenGL is better for rendering like movies and such.

Comparison of OpenGL and Direct3D - Wikipedia, the free encyclopedia (http://en.wikipedia.org/wiki/Comparison_of_OpenGL_and_Direct3D)

Also, DirectX comes with a way wider range of documentation than OpenGL, I'm thinking mostly of the DirectX SDK now, but on google too...
And DirectX gives you the .dds texture format, which is better than .tga... (Don't think .png is a texture format)... Ok, the texture format was maybe a bit too random xP
But still. I believe this 'war' always comes down to personal preference...

MK27
04-15-2009, 11:39 AM
I've been in such 'wars' so often, I'm getting tired of them, still I feel a need to join each one of them

I've never been in one so now's my chance! LX



If you search on Wikipedia for DirectX vs. OpenGL, you'll see that it says clearly - DirectX is better for games while OpenGL is better for rendering like movies and such.

That's a good article, but it does not even seem to imply that, much less say it clearly. LX



Also, DirectX comes with a way wider range of documentation than OpenGL, I'm thinking mostly of the DirectX SDK now,

I think five or six massive books in print (including a boxed set!) should about do it. After all, if you are going to spend a quadzillion hours programming with the API, it would seem just plain stupid not to dish out the $50. LX

Also, openGL has a great, very active programmer forum. LX



But still. I believe this 'war' always comes down to personal preference...

Except that microsoft may be making that choice for you. Philosophically, I think it is better to have at least two of "something that does something" in the computer world fully developed and widely used. But since the MS money grubbing proprietary model can only hamper better programming, philosophically, I don't think it should be part of any of them. LX

Akkernight
04-15-2009, 11:51 AM
I like Microsoft and their products ;)
Also, I remember it saying it kinda clearly, since I used it in another flame war recently... Maybe I can dig up the quote again...

And MS only trying to get money and stuff is a made up lie! ESPECIALLY saying that DirectX 10 was only to get people's money since it did only work for Vista and now DirectX 11(?) for Win7, which is mostly the same... I believe it had something to do with DirectX 10 working with Vista's architecture, and not just to get peoples money... Still, this is just something I overheard from Elysia, not sure if I got it right...

http://developer.download.nvidia.com/presentations/2006/siggraph/dx10-effects-siggraph-06.pdf Nice resource showing some improvements for DirectX 10, got this of NVIDIA Developer Web Site - Tools, Presentations, Whitepapers (http://developer.nvidia.com/page/home.html)

MK27
04-15-2009, 12:47 PM
Maybe I can dig up the quote again...


Better dig hard. I have not read the whole thing, but I've looked at it closely enough to say that it does not "clearly" espouse one over the other. It's a good article in that there is not much "editorializing". LX

My point about MS is about vs. open source. I cannot believe that as a programmer, you would want to use an operating system for which you cannot access the source code, unless of course you are dedicated to making software for that OS, in which case I guess that makes sense.

Microsoft is money grubbing. There is nothing wrong with making money with computers, but the proprietary model (which in essence means keeping code secret) is bad for users, is bad for programmers, is bad for security, and in fact the only reason to do so is because the "proprietors" believe this is the best way to secure their position as the money makers (maybe it is, but maybe it's not even good for that*, and the industry still clings to it well, just because!) LX

That is money grubbing -- and they do not deny it, either. The video chipset manufacturers are even worse, and it certainly does not benefit their product (but because they all behave this way, "the best video card" is still bound to use proprietary drivers). Distributing executables without accessible source code will one day be considered ridiculous, and all the hardware + drivers that you think are so great today will be even better for it. LX

*There are open source billionaires, I believe, eg at Google.

lruc
04-15-2009, 12:57 PM
I say OpenGL because I can't stand microsoft. I really can't see how anybody likes their products.

cyberfish
04-15-2009, 01:00 PM
Nothing wrong with Microsoft money-grubing. That's what businesses do, and Microsoft is a business.

But denying that is stupid.

MK27
04-15-2009, 01:09 PM
That's what businesses do, and Microsoft is a business.

But denying that is stupid.

What's stupid is not using your brain ;) If I kidnapped your family because I could sell them, then got paid to cut your legs off, no one would deny that is a business, but few people would think there was "nothing wrong with it".

I'm against regulating the industry, but the one law I would go for: No distributing executables unless the source code is public. In a slightly smarter universe, it would have been that way from the beginning.

cyberfish
04-15-2009, 01:24 PM
Haha I see.

What I meant is, there is nothing inherently wrong with "making money".

MK27
04-15-2009, 01:31 PM
And of course what I meant is, there is nothing inherently right about it either.

(Well, I guess making money is always good, but the "goodness" is not inherited by the method. Only the most dunderheaded could believe that rich people are good people, or that your paycheck is a measure of anything other than your income.)

Akkernight
04-15-2009, 02:31 PM
Do you people even consider the amount of work put into Windows and all Microsoft products? All the pay checks Microsoft had to give to their employees so that you can now have gotten this big a step in technology... If I could, I'd gladly pay for each product I use, still I'm a 'student' kinda, atleast don't work for a stable income, thus can't buy all, and since I need some things I do use torrents... Still, all the games I've cracked and liked ( and by liked I mean played them more than once or twice ) I've bought just 'cause I've played them so much, still I stopped playing after I bought them, kinda...

I use torrents as a type of trial or demo... And also, the 'goverment' here claimed that there is no law against electronical piracy where I live...

So these buisness' do not only secure their payroll, but also give us the options we have today...

MK27
04-15-2009, 03:07 PM
Do you people even consider the amount of work put into Windows and all Microsoft products?

I am absolutely not slamming MS for employing computer programmers, or for being a driving force in the home computer epidemic! I did not say they, or anyone else, should give their products away! I said they should make their code public.

There is a misconception that this will make piracy easier; it might a little bit, but I very much doubt that it would make much difference, because it would still be easy to have the products registered and anyone who is capable of hacking that out of the code could probably pirate it now anyway.

The justification for keeping code secret (witness hardware drivers are free) is that you can then maintain an edge over the competition because your proprietary code is better than their proprietary code. Which is a little stupid, considering how easy that sort of industrial espionage must be; all though it may be illegal, do you seriously believe that a money making software developer who really wants a look at NVIDIA sources won't get it? The only thing it prevents is your manager putting a bunch of people in a room and saying, "okay, today we will be examining our competitor's sources".

In reality (in fact, this is logically bulletproof), your code will be better if it is open source. Even the best programmers in the world could make a mistake -- what if the source is hidden? Etc.

In the end, microsoft users are in effect paying to slow down the pace of development, which >2000 AD that is showing some consequences, I hear*. The reason people use windows is because that's the standard, and it makes sense -- if you don't want to be a programmer, you shouldn't have to in order to use a computer. But ease-of-use is developer intensive, meaning you have to pay for it, which is also to say, just because something is open source doesn't mean hordes of board programmers will be rushing over to finish your project in their spare time. There really is not a good justification for not making code public. Microsoft has their ball not because they are not open source, but because of history. If I had such a ball, I would probably be so scared of dropping it that I wouldn't want to change anything in my "business model" and just bank on inertia. Is the ball good? I guess if you are Bill Gates. The current state of American Car Manufacturers might be considered here.

Unfortunately, it is probably the same human tendancy toward mindless repetition (it's easier on your mind) which makes the business people stick to a "closed source" model; there really is not a good reason, but a lot of rhetoric (like, you can't make money otherwise) is still hanging around.

* by that I mean funding a sort of dysfunctionalism, and accepting dysfunctionalism as normal because not much contrast is available to you.

cyberfish
04-15-2009, 03:54 PM
Do you people even consider the amount of work put into Windows and all Microsoft products?


and compare it to how much they make from Windows?

Yarin
04-15-2009, 05:36 PM
DX is more thoroughly document. But not by much. OpenGL is documented well enough - and as was already stated, forums and such can always provide any extra help needed.

OpenGL is simpler and easier, more stable, smaller and more compact, in some cases faster, and much more widely supported (cross-platform). Not to mention you're supporting a good cause. :D

It's true that GL doesn't natively support loading of advanced graphics or models. But that's because OpenGL is a 3D rendering API, not a complete game dev API like DX. If you need something, there are hundreds of libraries out there that can do what ever a specific DirectX feature can do - often better. And the really good libs are usually also cross-platform like GL.

The only way I see DX as being "better" is that everything you need is already there. But the programming headache (and the rotten COM) more than makes up for that plus.

Please do tell, how is DX better - in spite of all this?

abachler
04-15-2009, 05:38 PM
Please do tell, how is DX better - in spite of all this?

Because DX is implimented in hardware, while OpenGL is a translation layer on modern equipment. This has been done to death, someone please merge this thread with the 500 other DX vs OpenGL threads and then close them.

Yarin
04-15-2009, 05:42 PM
>> Because DX is implimented in hardware, while OpenGL is a translation layer on modern equipment.
How is OpenGL being software instead of hardware a bad thing though?

psychopath
04-15-2009, 05:48 PM
Because DX is implimented in hardware, while OpenGL is a translation layer on modern equipment.
Unless I misunderstand you, both D3D and OGL are essentially just layers on top of the hardware allowing access to driver features. OpenGL just happens to be a spec rather than a real library.

Of course, I may just not completely understand how D3D works.

MK27
04-15-2009, 05:53 PM
Because DX is implimented in hardware, while OpenGL is a translation layer on modern equipment.

This is bogus. Sorry. It is not even meaningful and you will never see an explanation from the man, either. Rhyme w/ gibberish -- the emperor wears no clothes an so on.

ps. if you aren't interested in the thread, don't read it, and don't inject little red herrings like this, since it only contributes to the problem you are complaining about ("gee, here's something I don't care about, maybe I should make up some garbage and try to sabotage the thing..." -- I'd call that trolling)

VirtualAce
04-15-2009, 06:17 PM
Because DX is implimented in hardware, while OpenGL is a translation layer on modern equipment. This has been done to death, someone please merge this thread with the 500 other DX vs OpenGL threads and then close them.

I ditto your sentiments but no rule has been broken here so there are no grounds upon which to close the thread.

abachler
04-15-2009, 06:39 PM
I ditto your sentiments but no rule has been broken here so there are no grounds upon which to close the thread.

Could you at least merge it with previous threads on the subject then, so the same lame arguments arent rehashed once more all over again, for the umpteenth time.

http://cboard.cprogramming.com/game-programming/110634-opengl-directx.html
http://cboard.cprogramming.com/game-programming/90919-opengl-directx.html
http://cboard.cprogramming.com/windows-programming/76121-directx-vrs-opengl-witch-one-better.html
http://cboard.cprogramming.com/game-programming/69041-better-start-off-directx-opengl.html?highlight=directx+opengl
http://cboard.cprogramming.com/game-programming/67990-opengl-directx.html?highlight=directx+opengl
http://cboard.cprogramming.com/game-programming/62430-opengl-directx-2d.html?highlight=directx+opengl
http://cboard.cprogramming.com/cplusplus-programming/58633-allegro-opengl-even-directx.html?highlight=directx+opengl

and a bunch of others (http://cboard.cprogramming.com/search.php?searchid=1618324)

Yarin
04-16-2009, 10:44 AM
>> and a bunch of others
vBulletin Message: Sorry - no matches. Please try some different terms.
:D

philvaira
04-18-2009, 01:29 PM
Hello,

My name is Phil and I am a recovering bias addict.

OpenGL and Direct3D do about the same things. They call the same graphics hardware. OpenGL was easier in the past due to its simplicity (anyone remember execution buffers in Direct3d?) But now, DirectX is easier because it offers more in abstraction while OpenGL gives you the bare bones. There is more work on your side to abstract if you use OpenGL. This is already done for you in DirectX. Regardless though, chances are you will create your own libraries for code reuse.

If you see yourself developing on Windows, use DirectX. A new Windows OS installed does ensure you have DirectX drivers for hardware acceleration. OpenGL is iffy. Chances are it still has the old OpenGL 1.1-1.4 drivers. Actually, I had a laptop previously that did not have drivers by default. I don't think XP/Vista does because the extensions were much less before installing the drivers.

Vista gave three options to get a OpenGL-rendered application to work.



Option #1:
MSOGL - this is an implementation of OpenGL 1.4 that uses Direct3D under the covers to hardware accellerate the application.

Option #2:
Legacy ICD's - These are the ICD's that are available today for use on Windows XP. These will continue to work on Windows Vista, but will disable the DWM when they are loaded in to the process of the application that's using OpenGL. The reason for this is that Legacy ICD's operate directly on the GPU without going through Windows at all, and we have no way of redirecting application's output in a stable, predictable manner.

Option #3:
Windows Vista ICD's - this is a new path for 3rd party ICD's introduced for Windows Vista that will work in a way that is compatible with desktop composition. Essentially allowing direct access to the GPU for hardware accellaration, but then having the final surface that appears to be the front buffer to the application actually be a shared surface that gets composed by the DWM


To me, that's a mess to deal with and the support calls saying why their game is running slow.

Any developer who published a small game can tell you they had more support issues with consumers using OpenGL drivers. You have to rely that the consumer installed their drivers. But still, it's the same story for DirectX. If you're using DirectDraw, or Direct3D8, even 9, it is possible they won't have to install drivers on Windows until your application requires shaders and the like. If you're using Windows, I think there is less driver problems and a lot less going into software mode (especially in Vista) if you choose DirectX. DirectX is the safe way to go. If you're wanting cross-platform, use DirectX for Windows and OpenGL for the others. You should have both render paths like most game companies do (Blizzard Entertainment, for one). If you have one rendering library, adding the second one should not be hard to implement. I remember it took me less than a day because the functions were the same. It just had different render calls within it.

JVene
04-20-2009, 02:10 PM
If you're wanting cross-platform, use DirectX for Windows and OpenGL for the others. You should have both render paths like most game companies do (Blizzard Entertainment, for one). If you have one rendering library, adding the second one should not be hard to implement. I remember it took me less than a day because the functions were the same. It just had different render calls within it.


Bravo, yes - and the conflict may then end!

Pick up Wild Magic, and/or any book by Eberly on that engine (which is a good if not great example of engine design, focusing on the math).

Specifically, note the design of that engine implements the renderer as an abstraction, such that application code need not be concerned with how things are rendered. Using modern C++ techniques (perhaps more so than in Eberly's library), the 'weight' of this technique can be so minimized that platform independence, with the option of choosing the best of these two even at runtime, is a reality.

Even WITHIN a target choice (say you're a DX expert and insist upon it) - you have a portability issue! It has been so for many years within Windows, within Unix, and, within OpenGL and DX. You must be in a position to straddle more than one version of any API, and that can mean optional features available in one version must be turned off in another. Portability isn't just about crossing platforms, it's about following a platform forward, too!

Now, on some popular hand helds, OpenGL ES is all there is.

On XBOX? Isn't that a non-OpenGL machine?

When you successfully abstract rendering, it won't much matter anymore.

indigo0086
04-20-2009, 02:57 PM
FOr OpenGL's lack of support I'm thinking of starting up with DirectX as opposed to OpenGL.

VirtualAce
04-20-2009, 08:44 PM
JVene hit upon an important concept that is overlooked in all of these types of debates. If you code your system to an interface rather than an implementation then stayability (if that is a word), portability, and compatibility should not be that big of a deal.

Comparison of OpenGL and Direct3D - Wikipedia, the free encyclopedia (http://en.wikipedia.org/wiki/Comparison_of_OpenGL_and_Direct3D)

Note that the article states it might require cleanup to meet Wiki's standards so read at your own risk.

MK27
04-21-2009, 06:41 AM
Bubba you're a riot!
...post #8


If you search on Wikipedia for DirectX vs. OpenGL, you'll see that it says clearly -

Comparison of OpenGL and Direct3D - Wikipedia, the free encyclopedia
...post #25



This has been done to death, someone please merge this thread with the 500 other DX vs OpenGL threads and then close them.
I ditto your sentiments but no rule has been broken here so there are no grounds upon which to close the thread.
...post #31


JVene hit upon an important concept that is overlooked in all of these types of debates. If you code your system to an interface rather than an implementation then stayability (if that is a word), portability, and compatibility should not be that big of a deal.

Comparison of OpenGL and Direct3D - Wikipedia, the free encyclopedia

Note that the article states it might require cleanup to meet Wiki's standards so read at your own risk.

I still think it's a good article ;) The best part is someone seems to have been adding to it in the past week or so...

VirtualAce
04-21-2009, 04:45 PM
How does this 'make me a riot' so to speak? Other than the fact that two of us posted a link to the same article which indicates to me this information is readily available and accessible on the internet. I did a quick google search and posted the first wiki that came up without having read post #8. So this tells me this thread is not needed and the answers to various questions about the APIs can be answered one good read of the wiki.

MK27
04-22-2009, 07:36 AM
How does this 'make me a riot' so to speak?

People usually associate irony with drama but it always seems to me more about comedy.