Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×

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.'"
This discussion has been archived. No new comments can be posted.

Why You Should Use OpenGL and Not DirectX

Comments Filter:
  • by pyalot ( 1197273 ) on Friday January 08, 2010 @05:46PM (#30700546)
    1) completely bogus: OpenGL has an both a good documentation and extremely good literature
    2) completely bogus: These days M$ is advocating *not* using anything Like DirectInput, etc. In fact, DirectSound doesn't even work on Windows7
    3) completely bogus: If you're not doing C#/C++ on Visual Studio using Com+, you're not getting DirectX. OpenGL can be coded in anything, Delphi, Python, C (gcc), C++, perl, Ruby, etc.
    4) The only thing you got right, remotely
    5) completely bogus: Before version 9 or 10, DirectX was the most hard and retarded thing to pick up, then it slowly, very slowly, got better.
  • by jfbilodeau ( 931293 ) on Friday January 08, 2010 @05:49PM (#30700580) Homepage

    Corrections/clarifications

    1) So does OpenGL
    2) True -- Let's talk Direct3D vs OpenGL
    3) False -- Name me one language that doesn't have OpenGL bindings
    4) The 360 has a DirectX-like API. OpenGL-like interfaces is used on Wii and PS3
    5) OpenGL is easy(er?) to pick up

  • by pyalot ( 1197273 ) on Friday January 08, 2010 @05:49PM (#30700582)
    All of Rages/IDs software runs on OpenGL... that not quick enough for you?
  • by sopssa ( 1498795 ) * <sopssa@email.com> on Friday January 08, 2010 @05:52PM (#30700630) Journal

    3) DirectX works just fine with C/C++/Delphi. I have used it with all of those, from version 6.
    5) Not really. I'm not even a game developer myself, and I was a teen at that age, but version 6 of DirectX was really easy to pick up. And I used it with Visual Basic and Delphi, because frankly C/C++ was pain in the ass to quickly create something fun as a 12 year old. And so did games too - only games supporting OpenGL was those based on Quake engine, and even they had DirectX engine too (HL did at least)

  • I've used both (Score:3, Informative)

    by shadowrat ( 1069614 ) on Friday January 08, 2010 @05:56PM (#30700688)
    DirectX is made for games. You can use it for other kinds of applications, but if you want to do something that you do in a game, there is likely a function or construct specifically for what you need. It's docs assume you are making a game and when there are multiple ways to do something they often point out the faster way. heck it only works with triangulated mesh data.

    Open GL is made for EVERYTHING. Sure, you can use it for games. There's nothing wrong with that, but i'm not John Carmack. That shit is hard for me. If i want to make a game, i'll take the platform that holds my hand.

    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.

    anyway modern game development means licensing an engine. engine developers worry about supporting open gl or direct x.
  • by Nadaka ( 224565 ) on Friday January 08, 2010 @05:57PM (#30700694)

    I would also point out that there are open standards for networking, input and sound. They just are not all bundled up under a single name.

  • by msclrhd ( 1211086 ) on Friday January 08, 2010 @05:57PM (#30700698)

    OpenGL is a graphics-specific API (like Direct3D). If you want sound, network, etc. support, try SDL or Qt.

  • by shutdown -p now ( 807394 ) on Friday January 08, 2010 @05:59PM (#30700722) Journal

    If you're not doing C#/C++ on Visual Studio using Com+, you're not getting DirectX. OpenGL can be coded in anything, Delphi, Python, C (gcc), C++, perl, Ruby, etc.

    First of all, if a language can call C APIs (and, in particular, can deal with C function pointers returned by those APIs), it can call COM APIs as well. DX isn't even "COM", it just uses COM conventions (vtable layout, refcounting etc) - but it's not a set of proper registered COM objects. In particular, this means that you absolutely can write DX applications using gcc [blogspot.com] (e.g. Mingw, on Windows), and even g++, since its vtable layout is (by design) COM-compatible.

    Furthermore, there are plenty of high-level DX wrappers for various other languages: Delphi and Python from your list have them for sure, and there are many more (just google for "directx language").

  • by Anonymous Coward on Friday January 08, 2010 @05:59PM (#30700728)

    You are not up to date then. OpenGL 3.2 has it in the standard.

  • by trifish ( 826353 ) on Friday January 08, 2010 @06:02PM (#30700766)

    DirectSound doesn't even work on Windows7

    Where did you hear that? Because, that's nonsense (or, as you say, complete bogus).

  • by GooberToo ( 74388 ) on Friday January 08, 2010 @06:06PM (#30700818)

    Really the last place OpenGL stands strong is in AutoCAD and even they have indicated that the platform will not last longer, so we may see AutoCAD be using DirectX in the next few 5-10 years.

    I find that hard to believe. Right now there is a new renaissance in game development and game platforms. Mobile platforms are just now grabbing noteworthy market share and it looks like its only continuing to grow as more mobile devices increase in capability - especially 3d capabilities. Thus far that segment has clearly spoken. Thus far this segment is OpenGL and/or OpenGL ES. And that's entirely his point. You want to chase an emerging market plus cover all other platforms, you have exactly one option - OpenGL.

    If you develop via OpenGL you can address XP+Vista, Mac, Linux, iPhone, and Android, plus all the major consoles. Its one stop shopping. With DX and comparable graphics with OpenGL, you can only target Vista. If you want Vista + XP + Consoles, you're looking at DX9 which is a subpar graphics experience compared to that which is provided by OpenGL. Simply put, OpenGL provides you more platforms more easily.

    We most certainly have not reached any critical point which can not be reversed. As the author clearly points out, OpenGL vs MS is much the same today as it was in the past. At this point, its strictly about mind share and that needs to change.

    Much is said that OpenGL is less than DX, and that's true. But people seem in a hurry to ignore the fact that there is a standardize solution which is OpenGL/OpenAL/OpenSL/SDL. When game developers talk about OpenGL as a solution, they really mean all four. OpenGL has a complete solution which addresses both CAD and gamers alike. The only questions is, are companies smart enough to realize this - far too often, its seems not because of the MS marketing. And as I've said many times before here, MS is not so much a technology company as they are a marketing company. Generally speaking their technology is second rate, but their marketing and business prowess is world renowned. All too often people confuse the facts.

    Ultimately, the problem is that the PHB making the technology decision is simply unaware of the poor MS-centric decision they are making, which is then costing them additional dollars to later turn around and target the platforms they specifically excluded themselves from by picking DX in the first place. OpenGL needs to be championed by someone that understands how to speak PHB so that OpenGL can be fairly evaluated. Right now the only contender who is whispering into the PHB's ear is MS, and as a result, everyone is losing.

  • by Philodoxx ( 867034 ) on Friday January 08, 2010 @06:25PM (#30701058)

    I've dabbled in 3D programming, I haven't done anything amazing, let alone made my own game, but I will say that D3D is much easier to write working code than OpenGL. With OpenGL I got about as far as a spinning triangle on the screen. With D3D I was able to get to the point where I was rendering a model on the screen and manipulating it with pixel and vertex shaders.

    Somebody earlier hit the the nail on the head when they said that because it's easier it's what people will start and subsequently stick with. Not only that, but as a business if it takes your programmers 10 months to write a graphics engine in D3D and 12 months to write one in OpenGL, which one are you going to go for? There aren't many instances where I will go to bat for MS, but DirectX has a better graphics API compared to OpenGL.

  • Re:One language (Score:5, Informative)

    by drei0003019 ( 1191767 ) on Friday January 08, 2010 @06:28PM (#30701098)

    If you really wanna do that, knock yourself out: http://code.google.com/p/bfopengl/ [google.com] :-)

  • by TheRaven64 ( 641858 ) on Friday January 08, 2010 @06:36PM (#30701226) Journal
    I'm not sure about 7, but the Vista driver model disabled the hardware acceleration path in DirectSound. If you want hardware accelerated sound then you need to use OpenAL on Vista, not DirectSound. This irritated Creative Labs a lot, but considering the fact that they insist on putting buggy crap in ring 0 on any platform that they provide drivers for, they probably deserved it.
  • by thegsusfreek ( 769912 ) on Friday January 08, 2010 @06:39PM (#30701270)
    Maybe that's Carmack's "more recent comment", but the article mentions even more recent comments (at least, I assume they're more recent, since they mention DX10 and Rage).
    From the article, Carmack said:

    "Personally, I wouldn’t jump at something like DX10 right now. I would let things settle out a little bit and wait until there’s a really strong need for it."

    And:

    As John Carmack said when asked if Rage was a DirectX game, "It’s still OpenGL, although we obviously use a D3D-ish API [on the Xbox 360], and CG on the PS3. It’s interesting how little of the technology cares what API you’re using and what generation of the technology you’re on. You’ve got a small handful of files that care about what API they’re on, and millions of lines of code that are agnostic to the platform that they’re on."

    Sounds to me like he's still favoring OpenGL.

  • by Anpheus ( 908711 ) on Friday January 08, 2010 @06:48PM (#30701370)

    Hasn't Carmack all but reversed his position on DirectX, saying that OpenGL is failing to keep up?

    http://linux.slashdot.org/story/09/08/24/0059218/Linux-Port-For-ids-Tech-5-Graphics-Engine-Unlikely?from=rss [slashdot.org]

    Oh yeah.

  • by pyalot ( 1197273 ) on Friday January 08, 2010 @07:04PM (#30701554)
    You're completely delusional right? http://www.opengl.org/sdk/docs/man/ [opengl.org]
  • Re:I've used both (Score:3, Informative)

    by gbjbaanb ( 229885 ) on Friday January 08, 2010 @07:23PM (#30701798)

    You want to look at SDL [libsdl.org]

    Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer. It is used by MPEG playback software, emulators, and many popular games, including the award winning Linux port of "Civilization: Call To Power."

  • by andy55 ( 743992 ) on Friday January 08, 2010 @07:23PM (#30701800) Homepage
    It doesn't sound like you've developed much in the way of commercial quality graphics-centric software for "middle tier" end-users.

    Long story short is that if you ship a 3D software title that's designed and marketed to be run on as many machines as possible, modern OpenGL drivers tend to greatly lag or be unavailable on many Windows machines. Vista and especially Vista 64 really made this worse since maintaining and upgrading GL drivers for middle tier GPU hardware is generally at the bottom of the priority list for 3D driver development. Meanwhile, D3D support tends to be solid, speedy, and well maintained considering especially when you consider what hardware they have to work with.

    I'm a senior engineer at a software company that manages a cross-platform codebase that puts OGL and D3D under the same roof (we ship products for OS X and Windows). One of our older products requires OpenGL on Windows due to not wanting to rewrite all its shaders for D3D, and the number of support tickets that we get from that TOWERS our the number of support tickets from our other D3D titles combined. It's downright pathetic how poor OpenGL hardware and driver support is on these middle tier Windows machines.

    The last thing the guys and Intel and Nvidia that maintain the drivers for built-in chips that go on the typical Dell machine give a crap about are the state of their OpenGL support. I'm typically surprised to see them have support past 1.3.
  • OpenGL pride (Score:4, Informative)

    by pyalot ( 1197273 ) on Friday January 08, 2010 @07:25PM (#30701822)
    Irrefutable, feel welcome to try.

    - OpenGL works on Mac, Linux, WindowsXP and Direct3D does not (or only partially as in no DX11 for XP)
    - OpenGL compatible APIs are present on the PS3, Wii, iPhone and many other devices, wheras Direct3D works on none of those.
    - Cutting edge features can be accessed in OpenGL as they come out, whereas in Direct3D you'll have to wait until M$uck decides to iterate++ DX.
    - A wealth of good online and dead tree documentation can be had for OpenGL
    - A host of "killer apps" has been done and is continuing to be done with OpenGL (such as Maya, 3ds max, softimage, all iPhone games, Mac Games etc.)
  • Re:I've used both (Score:3, Informative)

    by thetoadwarrior ( 1268702 ) on Friday January 08, 2010 @07:55PM (#30702212) Homepage
    True DirectX offers a whole suite of tools but I suspect it's not best to use it for everything. Otherwise one of the biggest engines (Unreal) wouldn't be using OpenAL instead.

    http://en.wikipedia.org/wiki/OpenAL [wikipedia.org]

    It's also dishonest for the various people posting to claim that games are primarily done in D3D. That is true for a lot of PC games and all 360 games but no one uses D3D for Playstation. So any major engine has to support both as you will find one of the most popular (if not most popular at the moment) engine does indeed still support OpenGL. http://en.wikipedia.org/wiki/Unreal_engine [wikipedia.org]

    Granted, at the moment most non-mobile games are on Windows and the 360. If the 360 loses popularity then OpenGL would probably make a comeback for making things easier to port from the PS to the PC.
  • by Prune ( 557140 ) on Friday January 08, 2010 @08:11PM (#30702426)
    The standard has evolved significantly since Carmack posted this, and the state of OpenGL is much further along than it was then, as the committee has adopted an accelerated roadmap (to a large extent due to the championing of NVIDIA).
  • by Narishma ( 822073 ) on Friday January 08, 2010 @08:49PM (#30702796)

    Incorrect on both points. id was bought by Zenimax, which is the parent company of Bethesda, so Bethesda doesn't have any say on what they use or don't use. In addition, Carmack already confirmed that they'll use OpenGL for their next game on Windows and Mac.

  • Moving and all (Score:5, Informative)

    by Estragib ( 945821 ) <estragib@gma[ ]com ['il.' in gap]> on Friday January 08, 2010 @08:57PM (#30702898)

    Now if someone came and blew Powerpoint away, sold the software for less-- you bet your ass Microsoft would start moving again.

    The question is what move that would be. To judge by the past, they would, in order of feasibility: -

    1. rely on ubiquity of the .ppt format,
    2. spread FUD about security issues and TCO,
    3. pay bloggers, consultants and analysts to badmouth it,
    4. announce the next version of PPT, complete with mock-up screenshots, scaring off investors, then never release it,
    5. suffocate it with patent litigation,
    6. buy them out and
      1. kill it off,
      2. assimilate it (but not invest into further development, because, hey, no competition again),
    7. change office to be incompatible,
    8. change IE to be incompatible,
    9. change windows to be incompatible.

    (Not comprehensive.)

    All of this has happened before, and all of it will happen again.
    (aka: Are you absolutely positive you are not new here?)

  • by gmueckl ( 950314 ) on Friday January 08, 2010 @09:59PM (#30703490)

    What I see in this video is "just" a state of the art game engine renderer. The current generation of games only expoits a subset of the features of current generation hardware. Were it not for the strict realtime requirements that are present in games, which push the available CPU time for rendering in the range of 3 to 6ms for 60FPS (the rest of the time is taken up by other parts of the game), the visuals could be immensely more impressive. And none of that is something that can be done in DirectX exclusively.

    Hardware tesselation is demoed in the video you mentioned, but this is only available on highest end ATI hardware at the moment and AMD published extension specifications for that as early as March 2009 (see for example http://www.opengl.org/registry/specs/AMD/vertex_shader_tessellator.txt [opengl.org])! When did Windows 7 hit the market? October?

  • Re:I've used both (Score:2, Informative)

    by sjelkjd ( 541324 ) on Friday January 08, 2010 @10:15PM (#30703614)

    Your appeal to authority is based on references(Chris Hecker and John Carmack) who were commenting on the state of Direct3D over 10 years ago! Chris Hecker's article discusses execute buffers, a feature in Direct X version 3! John Carmack's .plan is from 1996. Comparing DirectX 3 and DX9 is just silly. The API has drastically changed. Right around DX9 it was doing a better job of exposing the underlying hardware than OGL. As of 2003(the last time I used OpenGL) OGL had all these vendor extensions, which meant you had to write different versions of your code(and your shaders!) to work on different hardware(e.g. NV_VERTEX_PROGRAM/NV_FRAGMENT_PROGRAM was nvidia only, and you needed different code for ATI). They finally came out with ARB extensions that worked on all hardware. Also both Nvidia and ATI had separate extensions for uploading geometry to the GPU for a while. It was a total pain.

    Here's one random example where DirectX has more helper functions than OpenGL. DirectX has built in support for Quaternions: http://msdn.microsoft.com/en-us/library/bb281611(VS.85).aspx [microsoft.com]
    OpenGL does not(you would need to use a custom library). Built in font rendering is another example. You have to load bitmap fonts in OpenGL.

  • by Anonymous Coward on Friday January 08, 2010 @10:49PM (#30703824)

    There is - its called Keynote, however its on the wrong platform to actually challenge Powerpoint.

  • by Anonymous Coward on Saturday January 09, 2010 @12:48AM (#30704630)

    Timothee Besset of Id says:

    "As far as idTech 5 (the Rage engine), it runs on PS3 and Mac already. Setting up idTech 5 to run on those platforms early on in our development cycle was a direct result of carrying Linux/Mac support in idTech 4 beforehand. It is likely i will be involved with idTech 5 in the near future, I'll be damned if we don't find the time to get Linux builds done."

    http://ttimo.vox.com/ [vox.com]

  • by Anonymous Coward on Saturday January 09, 2010 @01:14AM (#30704838)

    "They STILL do not have geometry shaders in the standard, and its freaking 2010!"

    Actually, OpenGL has geometry shaders starting in version 3.2. But they've been around as extensions before then.

    Extensions are where OpenGL truly shines. Anyone developing new functionality in a DX driver basically has to wait until MS updates the DX spec before anyone can use it. OpenGL extensions allow HW vendors to release their own ideas first (AMD, APPLE, INTEL, NVIDIA, and anyone else), and then they can collaborate on what goes into the final core spec.

    Prior to DX 9, OpenGL had always paved the way first with new functionality, but that changed. The OpenGL ARB has seen this and is trying to remedy this (which they will probably do within the next year).

    I'm willing to bet that you start seeing new HW functionality beyond DX 11 exposed in OpenGL prior to DX 12 coming out.

    My biggest problem with OpenGL is that they said they were actually going to remove things and then really didn't. Let's clean up the API already. If the workstation vendors want to stick with the older bits, perhaps they should collaborate on a shared software implementation that sits on top of the new lean-mean OpenGL?

  • by Zephiris ( 788562 ) on Saturday January 09, 2010 @01:56AM (#30705056)

    It's not officially supported, because it's a hacked implementation from the "Alky Project", and I doubt even the final source code they released after going under and not being able to stay funded.

    It's not real DirectX 10. No hardware acceleration, just an API wrapper from an incomplete project that couldn't get funding, which noone has continued (despite source being out there). It doesn't work with most games, and can cause severe stability problems.

    DirectX 10/11 for XP will not be possible unless Microsoft releases a service pack enabling WDDM drivers, which they've stated repeatedly they will not, will never do.

  • by Zephiris ( 788562 ) on Saturday January 09, 2010 @02:08AM (#30705114)

    That's why generally the extensions get approved after proving themselves stable/useful/coherent to the spec by the OpenGL ARB...and then still aren't supported by ATI.

    ATI's OpenGL support has infamously been bad since the beginning, when I was getting backported support for OpenGL 1.5 on my Geforce 256, and it beat the Radeon 32DDR in support, stability, and driver support.

    If Nvidia is the only one really putting backing force behind OpenGL (due to XGI's acquisition and S3's backing out of desktop graphics), that isn't the fault of the Khronous group, the ARB, the specification, or Nvidia. People always blame the predominant company if its competitors have simply made business decisions that made business analysts turn purple in confusion.

    OpenGL 3.0 might have watered itself down to appease CAD, but all of the hooplah is largely years old, and irrelevant. It's also apparently largely ignored that 3.1 and 3.2 have been out for quite a while, and largely improved against 3.0 (and that Nvidia supported it rather quickly).

    If you're still bitching about OpenGL 3.0 as an excuse, you're obviously in the DirectX-banner-waving-camp to begin with.

    When it comes down to -my- personal opinion, for clarity, I think OpenGL is less obfuscated, and better focused (on graphics). The perk that you get software updates per-version, and don't require an entirely new revision of hardware in general to fully support new minor versions and major updates to functionality, API, and performance, is also something that rarely (if ever) happens with DirectX.
    Basically everything you need 'for OpenGL' is also supplied with the driver directly. How many people always complain in forums and troubleshooting tickets that "OMG, I haven't updated DirectX on this fresh install, how come it's not the latest version of special hack-on DLL that this game from 4 years ago needs, but is largely the same as all others??".

  • by tyrione ( 134248 ) on Saturday January 09, 2010 @03:15AM (#30705422) Homepage
    How the hell are you insightful? The OpenGL market owns the Smartphone industry. It's well on it's way in owning the game console industry. It own the highend CAD industry and Engineering modeling industry. It accelerates all OS X variants, it's becoming the defacto on Linux distributions where it makes sense, it's moving into the Web via WebGL and with the steadily eroding world around Microsoft is obviously doing well with the recent 3.1/3.2 updates and it's lovely new pal, OpenCL 1.1 being worked on has convinced all the GPGPU vendors that OpenGL/OpenCL is the one two punch for all Graphics.
  • by BikeHelmet ( 1437881 ) on Saturday January 09, 2010 @05:07AM (#30705868) Journal

    Except that OpenGL is NOT better. It may have support for vendor's random GPU features, but technical features alone do not make for a better product.

    It has its pros and its cons.

    Up until 2007, these were the pros:

    • Superior performance
    • Superior image quality

    These still are:

    • Superior cross-platform support

    I prefer DirectX because it has better development support, a better development environment, an integrated complete game package, and provides nearly the same speed and functionality as OpenGL.

    Good reasons. Now, if you were developing a game for three consoles, Windows, OSX, Linux, and phones, then you'd probably want to go with OpenGL. Either that or face nasty dev time.

    As soon as you pass 2 target platforms, OpenGL is the better solution.

    This is inccorect. DirectX 10 does work on Windows XP, it is just not officially supported by Microsoft.

    And this is incorrect. The Alky project went down. It was never a complete implementation. Most of the features that worked could be enabled in DX9 mode anyway - they just weren't.

  • by Ralish ( 775196 ) <sdl@@@nexiom...net> on Saturday January 09, 2010 @05:21AM (#30705916) Homepage

    Conspicuously absent from the article is John Carmack's more recent praise of DirectX, instead opting for far older quotes from him that reference versions of DirectX that are now either obsolete or at the very least superceded; in particular:

    In January 2007, John Carmack said that "DX9 is really quite a good API level. Even with the D3D side of things, where I know I have a long history of people thinking I'm antagonistic against it. Microsoft has done a very, very good job of sensibly evolving it at each step—they're not worried about breaking backwards compatibility—and it's a pretty clean API. I especially like the work I'm doing on the 360, and it's probably the best graphics API as far as a sensibly designed thing that I've worked with."

    I don't know if it is the best graphics API mind you, but few would dispute Carmack's graphics programming credentials, and the above quote paints a somewhat different picture of his (modern) views on the API than the linked article.

    Source: Comparison of OpenGL and Direct3D [wikipedia.org]

The moon is made of green cheese. -- John Heywood

Working...