Why You Should Use OpenGL and Not DirectX 515
stickyboot writes "The independent games developer Wolfire describes why they decided to use OpenGL instead of DirectX. The article mainly discusses the marketing strategies behind DirectX and how the API became so popular. It also goes over why a developer would choose OpenGL over DirectX and what this decision means for the gamer. 'Back in 1997, the situation was similar to how it is now. Microsoft was running a massive marketing campaign for Direct3D, and soon everyone "just knew" that it was faster and better than OpenGL. This started to change when Chris Hecker published his open letter denouncing DirectX. Soon after that, John Carmack posted his famous OpenGL rant, and put his money where his mouth was by implementing all of Id Software's games in OpenGL, proving once and for all that DirectX was unnecessary for high-end 3D gaming. This lesson appears to have been forgotten over the last few years. Most game developers have fallen under the spell of DirectX marketing, or into the whirlpool of vicious cycles and network advantages.'"
Re:OpenGL and the rant about marketing (Score:3, Interesting)
If Windows didn't have these technologies used to prop it up we'd have far less Windows in the world, which, in many ways would be the greatest thing for the consumer and the industry (as far as innovation and progress goes). Without DirectX propping up the monopoly we'd have other technologies and far more companies that would provide innovative competition, thus providing more, and often better, products.
We know that when you have a large number of competitors you get better products. The eReaders are a perfect example. First the Kindle and now about 10 competitors all showing that the competition has created a much greater choice for consumers as well as better features. Further netbooks and tablet PCs as well as touch capabilities in phones and the tablets are perfect examples of what happens when there's no technology to lock you in thus propping up the monopoly.
Re:Former OpenGL developer (Score:5, Interesting)
I know its taboo to respond to oneself, but I forgot to mention the recent release of the GL books (red and orange) adequately display the state that GL is in. They STILL do not have geometry shaders in the standard, and its freaking 2010! Yes, you can use those shaders via extensions, but anyone who recommends that path has not been personally burned by vendors supporting extensions to different levels. Writing code that uses extensions that only work on Nvidia and not ATi (or vice versa) is NOT what GL is about!
Re:OpenGL and the rant about marketing (Score:4, Interesting)
The rant is no more of a rant than you find closed source rant about regarding open source.
And, the updated spec for OpenGL had glorious ideas but somehow they fell through. Then Microsoft decided they'd cancel support for OpenGL in Vista/Win7 (yay, way to compete -- try to kill a solid viable product used by so many).
OpenGL still has a bright future as soon as they can complete what they promised.
More like Developers don't CARE. (Score:4, Interesting)
The ultimate monetary advantage of using OpenGL for games (imo and ime) is it makes Mac porting a hell of a lot easier.
The ultimate monetary downside of making Mac games is that only a small fraction of the install base can upgrade their video cards - the one constantly-moving PC gaming component.
You can build a useable gaming PC for under $700 - the buy-in for a Mac with an upgradeable video card is presently $2499. With the vast majority of PC gamers using wintendos, Windows/DirectX is the LCD. It's where most (or all) of the money is.
I think it's fantastic that iD uses OpenGL and makes all of their games cross platform. I also think it's unfortunate that iD is the exception to the rule... but I also vote with my wallet, and I use a $600 non-upgradeable (video, anyway) Mac Mini for all of my Mac-oriented needs, and a massively-upgradeable, equally-priced Shuttle PC for everything else. Which includes a long list of games that haven't been released on the Mac - and even if they had been, wouldn't be playable on the GMA-950 video chipset. It's shite for games, fine for Photoshop... and Windows is the reverse for me.
If I need a wintendo to play Orange Box or S.T.A.L.K.E.R., does it really matter if the game uses DirectX or OpenGL?
Not really. :-|
Re:John Carmack ditched OpenGL (Score:5, Interesting)
This is really it, the summary almost sounds like a complete troll.
OpenGL didn't lose out because of Microsoft's marketing, it lost out because whilst OpenGL stagnated, DirectX grew and grew to become a completely unified games development framework. Carmack may have had a point 12 years ago, but whilst OpenGL development completely ignored criticisms, Microsoft took criticism from the likes of Carmack on board and improved performance of their API whilst adding new features, providing great documentation and tidying up the interface.
Citing an argument from over a decade ago is desperate to say the least.
OpenGL needed to become something more, it needed to become part of a unified game development library in itself- we had part of that with OpenAL but it needed everything, we simply need an Open Multimedia/Gaming framework that can do everything that DirectX can do.
The fact is, game development requires more code and more content than ever before, developers can simply no longer justify spending time on filling in the gaps when other libraries like DirectX already have those gaps filled.
I would love nothing more than a resurgence of a set of open libraries covering the various facets of game development like DirectX does because it'd mean near zero effort porting to Mac and Linux, but right now the extra effort required to use OpenGL and OpenAL and then fill in the other gaps yourself coupled with the additional support requirements just doesn't justify the relatively minimal extra userbase for many developers.
Re:OpenGL has/had Killer Apps! (Score:4, Interesting)
You mentioned Quake 3 (which is just a little over a decade old) that got me thinking, what software DOES run OpenGL?
http://en.wikipedia.org/wiki/List_of_OpenGL_programs [wikipedia.org]
The fact that I didn't know most of those titles (many of which I have or have played) had support for OpenGL is a testament to the lack of marketing and the push the OpenGL community needs to make to get people excited about it.
Re:John Carmack ditched OpenGL (Score:4, Interesting)
whilst OpenGL development completely ignored criticisms, Microsoft took criticism from the likes of Carmack on board
That kind of feedback is actually formalized - there's a committee called Microsoft DirectX Advisory Board. I'm not sure whether Carmack is on it, but e.g. Tim Sweeney (the Unreal guy) is, judging by one of his interviews.
I don't know how much influence that board has over DX design, however ("advisory" in the name gives a hint, but there is still a wide range of possibilities). Would be interesting to know. Could it be that D3D9 was a significant leap that Carmack claims it to be precisely because of heavy participation in its design by people who actually use it?
Re:More like Developers don't CARE. (Score:3, Interesting)
Majority of PCs sold are laptops though, so it makes smaller difference now.
Re:Former OpenGL developer (Score:1, Interesting)
Pleasing the CAD community is a non-trivial thing, by the way. I'd MUCH rather they keep CAD in mind at the expense of the latest and greatest shiny in games - CAD systems do Real Work and Important Work. Games just aren't that important, and when creating something like the OpenGL spec I'd think the priority should be with the more important applications. If they want to create a Game Specific API (like DirectX) then no problem - but keep OpenGL around and have it focus on CAD - I can live with two APIs if the card folk can.
Re:Former OpenGL developer (Score:4, Interesting)
OpenGL is clearly behind DirectX ...
You're contradicting TFA without any evidence. TFA provided quite a lot of evidence to support its position such as:
It's common knowledge that OpenGL has faster draw calls than DirectX (see NVIDIA presentations like this one if you don't want to take my word for it), and it has first access to new GPU features via vendor extensions. OpenGL gives you direct access to all new graphics features on all platforms, while DirectX only provides occasional snapshots of them on their newest versions of Windows. The tesselation technology that Microsoft is heavily promoting for DirectX 11 has been an OpenGL extension for three years. It has even been possible for years before that, using fast instancing and vertex-texture-fetch. I don't know what new technologies will be exposed in the next couple years, I know they will be available first in OpenGL.
So no, I don't think you can just drop such a comment and be taken seriously. You're going to have to back that up.
Re:OpenGL and the rant about marketing (Score:5, Interesting)
5) OpenGL is easy(er?) to pick up
It used to be, with the fixed-function pipeline. Unfortunately all of the easy bits were deprecated with 3.0 and removed with 3.1 (fortunately people like nVidia then re-introduced them all as extensions). OpenGL 3.1 is incredibly powerful, but I wouldn't describe it as easy.
Re:I've used both (Score:5, Interesting)
Please RTFA. Also, Chris Hecker's [chrishecker.com] article, linked from TFA. Then give us specific, technical reasons that DX/D3D is somehow better for games than OpenGL. Your post is filled with assertions, but with nothing to back them up. It's pretty sad that got moderated "informative".
Again, RTFA. Give specific, technical reasons that OpenGL is "harder" than D3D. If you'd bothered to read Carmack's position, his favoring of GL was because GL is easier. Your inability to deal with OpenGL putting your claims in doubt aside, you could at least be specific about the reasons. As per Chris Hecker's article, the only one making these claims are Microsoft evangelists. You wouldn't happen to work for Microsoft would you?
This is a bit disingenuous. All of the articles involved are addressing the 3D aspect of DX. The rest of the stuff is either trivial (use SDL or similar which is about the simplest API you could imagine, has a billion support libs, and runs on everything), or you'd be doing it by hand anyway (implement your own networking stack for performance, a la EVE). Your point is therefore irrelevant.
You seem to be a lazy-enough or low-end-enough developer that this article does not apply to you. However, it does matter to developers who make engines (either primarily or otherwise). Perhaps you should move along; these are not the articles you are looking for.
Re:OpenGL and the rant about marketing (Score:2, Interesting)
[Slashdot ate my post, so I'll try again.]
It's more than this. The article is a serious bit of FUD. OpenGL lagged behind in implementing DX10 features, such as geometry shaders, and the people who were disappointed with OpenGL 3 and decided to try DX10 weren't Microsoft lackeys. The article links to a 3-4 year old NVIDIA article mentioning that Direct3D call overhead is higher than OpenGL's, and that's true for DX9. A large part of the work on DX10 was to remove overheads. The tesselation available in OpenGL is ATI's previous simpler installation, which was also available for Direct3D (as a proprietary extension from ATI), and my guess is that the latest tesselation hardware isn't yet available in OpenGL (correct me if I'm wrong). Catalyst 9.12 added support for GL_ARB_geometry_shader4 and cube map arrays (see the release notes), features available in Direct3D for quite a while.
I agree that OpenGL is the best for cross platform, the rest of the article is IMO bad advice for developers who want to develop cutting edge games. It's not terrible advice, and it actually makes some sense for indies, but still... I do want to see Microsoft continue to dominate for the simple fact that it's the only one actively trying to advance the hardware and keep both major players supplying the same features. OpenGL is neat in providing a way to add unique features, but these are developer hell. Using different extensions on different hardware makes things a lot harder, and it takes quite a bit of time for the ARB to standardise on an extension.
Regarding WebGL, I think it's the future for indies, the only important thing I see missing there is a way to protect your code. That could be a real issue. My prediction for the future is that the PC as we know if will decline, as the web browser will become an application platform that's decoupled from the OS. OpenGL (ES) has an important place as the backbone of the OS, but I don't know how much it will be used directly. So I do think that OpenGL will win in the long run (unless microsoft decouples Direct3D from Windows).
Re:OpenGL and the rant about marketing (Score:3, Interesting)
OpenGL? Better? Sure, it was once. And it was going to be better than DirectX again, with the release of OpenGL 3.0. But then the Khronos group scrapped the Long Peaks draft to appease the CAD companies. Yes, there are extensions and with vendor specific extensions, OpenGL can do everything Direct3D can today. But after how many GL_NV_* extensions does OpenGL stop being a cohesive API?
D3D backwards compatibility is A JOKE! (Score:1, Interesting)
I still love playing the old Thief games from around 2000. If you try to run them on modern cards, there are problems ranging from downscaled color depth to failing to initialize the 3D device entirely. Compare this to other favorite games of mine, like Sin and Quake. Sin and Quake just run immediately on even the newest video cars without issue.
Opengl seems to have much better backward compatibility.
Re:OpenGL has/had Killer Apps! (Score:4, Interesting)
http://developer.apple.com/macosx/architecture/index.html [apple.com]
http://developer.apple.com/graphicsimaging/opengl/ [apple.com]
http://en.wikipedia.org/wiki/Core_Image [wikipedia.org]
What DirectX does that OpenGL/SDL don't (Score:2, Interesting)
What DirectX does that OpenGL/SDL don't ...provides sound and frame sync. I could moderate in this thread (I have points), but no one had mentioned this crucial issue. Sure, if you are doing scientific visualization, you're going to use OpenGL, either on a Mac or on incredibly budget Linux-running white box hardware because you don't have the $ for anything else. But if you want to d games, it's important to have both the sound and the image (and haptic feedback, and anything else) synchronized. Same for using it for video playback or video chat. Apple goes out of its way to provide Apple-specific APIs for this, just as Microsoft provides DirectX, and the code you write using them is no more portable to other platforms than DirectX code is.
For very high frame rates, which are used to allow speculative pre-calcualtion and discard (i.e. pre-computing "the road not taken" in a multipathed decision tree, and throwing it away if a different road is taken), it's even more important to have the ability to combine work lists for speculative rendering along with audio etc. for the work, should it be used.
OpenGL is a graphics language. It's good at what it does, but it's not good at what DirectX does on top of that.
Disclaimer: I work for Apple, and yes, I'm making more or less positive comments about "DirectX vs. OpenGL" when considered for a particular use related to what the article author proposes to use OpenGL for...
-- Terry
Re:I've used both (Score:4, Interesting)
``anyway modern game development means licensing an engine. engine developers worry about supporting open gl or direct x.''
Exactly. That makes me wonder why they actually bother supporting DirectX, though, seeing as DirectX really only works on Windows, which is also supported by the APIs that the other platforms use.
``Plus, like others said, direct x is a whole game api. it's not just graphics. it's input, it's networking, it's sound. the whole platform is very cohesive. I'd rather just keep up with one api, one download, etc than have to follow open gl, open al, etc.''
But you don't; you just use the engine and let the engine developers worry about platform specific APIs. You even said as much yourself.
Also, I don't know to what extent DirectX is "one api". The way I understand it, DirectX is, first of all, made up of several different APIs for different purposes, e.g. Direct3D, DirectSound, and DirectInput. So there isn't really just one API. As for keeping up with it, to what extent is DirectX actually backward and forward compatible? I have never coded for it, so I don't know, but I got the impression that compatibility is often broken between releases. OpenGL seems (again, this is just my uninformed impression) to be rather stable, favoring extensions over completely changing things. Given these things, I find your argument that, with DirectX, you have to only keep up with one API hard to follow. To reiterate, I don't think it's one API, and I don't think it's easier to keep up with than its competing APIs.
Re:Former OpenGL developer (Score:3, Interesting)
That's a problem that OpenGL seems to perpetually have, they are always playing catchup with cards. Graphics cards do something new, OpenGL takes a long time to get a proper implementation of it because they claim "Oh you can just use extensions!" Meanwhile, Direct3D is always on the cutting edge. Why? Well because MS works with the graphics card vendors. It is a two way process: MS tells the GPU vendors "These are the kind of things we want to put in the next generation of DX," graphics companies say "These are the capabilities our future cards are going to have," and so on. They work back and forth such that when the hardware comes out, MS is is at least very close to delivering an API for it, if they haven't already.
That sort of thing does matter. It hurts your API when you are behind the times continually, especially when it comes to games. If you are a company developing the next generation of your games engine, you want to be targeting the high end technology. If OpenGL is going to take a good deal more work because you have to use specific extensions, and then perhaps more work again when they get standard support, that makes it less attractive.
Re:OpenGL and the rant about marketing (Score:3, Interesting)
Re:OpenGL and the rant about marketing (Score:4, Interesting)
1) openGL documentation sucks at best. Examples are all of the same beginner draw a triangle type.
2) Not only does directX provide more than just graphics, even within the graphics space it provides a lot more grunt code I have to do myself in openGL.
3) I use managed languages. I am not developing a game, I am developing business software (CAD/CAM related). Both openGL and DirectX currently suck in this respect. At least directX has XNA for games. OpenGL has no native (managed) Windows forms or WPF implementations. If I was developing a game, XNA is the easy choice. But since I am developing a business app, I live with stale dead third party libraries (TAO in this case).
4) Very relevant - for whatever reason, mind share is currently on DirectX - and from a community support perspective that is huge.
5) I was able to be productive in directX 8 (where I started) enormously faster than openGL. Even now, I end up converting directX code to openGL most of the time, as opposed to finding openGL code that shows what I am trying to accomplish.
Like I said, I wished I would have stayed with DirectX. If and when this project gets completed I will never use openGL again unless they provide better managed language support , better documentation and better built in functionality. I get tired of passing in integer values to set parameters. When I want to set a light color I want to call SetLightColor(Color), not setSomeParamater(12, 15); It makes for unreadable and unmaintainable code. I know, there are those who still think C is great, and they write some of the ugliest code on the planet, let them collect in the a little tiny small group for all I care.
Re:Former OpenGL developer (Score:1, Interesting)
khronos announced the addition to the standard august last year
nvidia drivers officially supported september last year
ati drivers officially added it in december last year
so overall he's 3 months out of date
moreover, he's 1 month out of date
Re:What DirectX does that OpenGL/SDL don't (Score:2, Interesting)
SDL 2.0? (Score:4, Interesting)
The *nix Analogue for DirectX is SDL. Not OpenGL.
The thing is, for a few years now, there needed to be an SDL 2.0 that made it as easy to integrate things like Nintendo's Wiimotes, Playstation controllers, and other things. But After all these years, we seem to be stuck on SDL 1.2.x - I don't know why. GTK+ moved on. Qt Moved on, what happened to SDL?
Re:OpenGL and the rant about marketing (Score:4, Interesting)
Re:OpenGL and the rant about marketing (Score:2, Interesting)
You are missing much, much more important points here:
1. There is an SDK with literally hundreds of really, *really* cool top-notch high-end/highest-end demos for DirectX. Some of these come straight out of Microsoft Research. Nothing says "Use me! I'm cool!" like that set of demos. The closest thing on the OpenGL side of things that I know of is the demo gallery that nVidia has, but it's not as cool IMO.
2. There are debugging tools like PIX available for free. This thing has its restrictions, but seeing my colleagues analyzing textures, vertex buffers and draw calls graphically to figure out what they're doing wrong sometimes makes me envy them. And it turns out to be a real time saver. On the OpenGL side I find myself writing lots of this stuff from scratch just for my app. Sure, there are tools like bugle, but they are far inferior to what MS has to offer.
Having said that, I still feel more comfortable with OpenGL on Linux. This is what I'm used to and it works for me - not that this will ever make a difference, though.
Re:One language (Score:3, Interesting)
Wrong, the svn is empty, yes, but you can download the interpreter code and some docu as zip. Apparently it supports some 18 glut/gl calls.
*removed because: Filter error: Please use fewer 'junk' characters.
Tempest in a Teapot (Score:2, Interesting)
I had higher hopes for the original article in discussing specific technical reasons for choose one API over the other aside from the issue of platform support.
From my perspective, the the controversy boils down to a handful of actual issues:
* Quality of drivers. D3D drivers have historically been more solid than OpenGL drivers on Windows. This is less of an issue these days with Nvidia. Unfortunately ATI OpenGL drivers remain a bit flaky.
* Market. I believe that the very high end graphics workstation market (think Hollywood CGI artists, CAD, etc) is still invested heavily Unix (Linux) based tools. Nvidia has a much bigger foothold in this market than ATI which explains why Nvidia has superior X.org drivers and better OpenGL support all around.
* Bleeding edge technical features, if you are trying to achieve some advantage in rendering quality over your competitors. This makes sense in the graphical arms race of gaming, but most of the rest of the visual simulation industry (3D modeling, CAD, scientific computing, government/military, etc) don't care about the cutting edge as much.
* What your 3D engine of choice supports. Writing a whole 3D engine from scratch is going to be silly most of the time with the many commercial and open source 3D engines now available, so you are not going to be writing a whole lot of bare D3D or OpenGL code.
Like a lot of other areas, Microsoft's development solutions work great if you stay in the Microsoft ecosystem. As a pure business decision sometimes it makes sense.
What irks people (including me) is when Microsoft deliberately or de factor freezes out the competition; this is where we end up with frustrating situations like the case of ATI having inferior support for OpenGL on Windows. There's no technical reason for it, just someone manager's decision on how to allocate developer resources. Longtime Linux users know this is a story that has played out with many devices; usually there is no technical reason a piece of hardware can't be used on Linux, it is simply a matter of the manufacture choosing whether or not to devote additional resources to supporting platforms other than the one with the biggest market share.
So ultimately it is about mindshare and putting pressure on Nvidia and ATI step up to the plate to have good OpenGL support, and encourage Microsoft it is not in their best interests to screw over Windows OpenGL users.
(did I mention enough times how much ATI OpenGL driver quirks annoy me?)
Re:OpenGL and the rant about marketing (Score:3, Interesting)
It's not a race. If software is written to a standard, there is an expectation that it can be moved to other platforms by simply recompiling.
The platform can then be chosen to meet the customers needs.
To give an example: A large company was using workstations made by ***, but were afraid that *** was going out of business. They then rebuilt the application to work on desktop systems made by **** utilizing graphics cards from ***** and ******. Since the applications used OpenGL for rendering, the move was simple. Unfortunately, neither of the implementations supported Z-cued lines, which was important for the application. The customer then tried workstations from vendor *** whose OpenGL implementation did support Z-cued lines.
Of course, wire-frame drawing with Z-cued lines isn't important in the gaming space, but using OpenGL as the lingua fraca allowed the software to be moved.
Does Direct3D support Z-cued lines? I don't know, and, frankly, don't care. The application cannot be moved to anything other than an Intel box, utilizing nVidia or ATI anyway.
Military applications, phones, embedded, are then not reachable.
So, sure, go ahead and use the graphics support that is appropriate. But, since there are only two platforms (Windows and XBox) that can use Direct3D, I have never even bothered to learn about it. It may be the "cat's meow", but it is easier to simply recommend the use of OpenGL on Windows (and I could not, honestly, care less about XBox), and guarantee at least a path for portability.