Slashdot Mirror


Direct3D vs. OpenGL: From a Developer's Perspective

richcoder writes: "GameDev.net has posted an informed article discussing the benefits and drawbacks to using either Direct3D or OpenGL in a game. I've already made the decision to go with OpenGL for my next project, but it looks like Direct3D is gaining ground. Especially in the area of making it simpler to code support for new video card features."

6 of 25 comments (clear)

  1. Seems somewhat biased... by djohnsto · · Score: 5, Informative

    The author seems to be somewhat biased towards OpenGL. This is fine, OpenGL is a good API, but it's starting to show it's age. Here are some points that I don't really agree with:

    - He poses the question as to whether low level access and flexibility is worth it (for D3D). He argues that the more simple OpenGL system is sufficient. That is not the case for most game developers. To get the same performance from OGL as you get from D3D, you really need to use extensions from Nvidia or ATI to get to the same level of flexibility that D3D already offers. Things like Nvidia's vertex array range (with NVFence), or ATI's vertex array objects are very, very useful, and a pain to use since developers need to use both to accomplish the same thing.

    - OpenGL on Windows does not support multiple monitors (or, I should say multiple video cards). Some drivers do relatively well here, but the WGL layer binding OpenGL to windows is severly crippled, and some dual monitor machines will blue screen just by trying to initialize OpenGL on a single monitor. D3D (since version 5) has no problems with multiple monitors.

    - COM is hard to use: probably true, but DX hides as much COM as you possibly can. The result are C++ interfaces that make using DX without directly linking to it much easier. Writing apps that load the underlying rendering libraries (instead of linking with them) will be much easier with D3D than OpenGL. D3D requires 1 function to be queried for (Direct3DCreate), OpenGL requires dozens.

    - D3D requires more code: Possibly true, but not for window initialization, more for texture and vertex buffer initialization. Actual setting up of texture state and render state are nearly identical. In any case, the code size difference is negligible.

    - OpenGL is cross platform: But support on the Mac SUCKS!! Apple, in their infinite stupidity, decided that extensions that don't work on the Rage 128 wouldn't be supported. So, people buying those $4000 macs with GeForce4 TI cards can be happy with the fact games that are written to use new fangled features like vertex and pixel shaders will never work on the Mac. This may change when DOOM III is released, but I doubt before then. Even support for anti-aliasing would be nice.

    I've written low level application rendering code in DX5, DX7, DX8, and OpenGL. There are areas of each that I like more than the others. In the end, I would probably pick DX8 over the rest, although OpenGL and DX7 are probably neck and neck for second.

    --
    Dan
  2. Some minor points by inah · · Score: 3, Insightful

    OpenGL 2.0 is years away from exposing the hardware to the level DirectX has. The ARB is slow, but hopeful in getting the extensions mess cleaned up.

    Microsoft Research has some heavy hitting names in graphics who are paid to do PURE research. This is a pretty formidable resource for Microsoft to leverage into making D3D indispensable to developers. Not every garage game hacker can whip out mesh skinning algorithms.

    On the Mac OpenGL side... The Mac OpenGL games have a few titles out now with full screen anti aliasing. One is the Spiderman 1.0.1 Patch just this month for ATI cards.

    The challenge with Mac/OpenGL support is developing a good relationship with ATI/Nvidia. Try getting into the community more. Not everyone has the connections Carmack has. The Mac Games Dev list (mac-games-dev@lists.apple.com) is very active.

  3. One major issue that he skirts... by wrinkledshirt · · Score: 3, Insightful

    Mindshare.

    If I want to start developing games, I'm going to be looking around to see what I need to learn. DirectX reference material creeps up more often than not. Games that use DirectX are more numerous. Teams need to be built around a common skillset.

    It's a chicken-and-egg problem, but it's there nonetheless.

    --

    --------
    Bleah! Heh heh heh... BLEAH BLEAH!!! Ha ha ha ha...

  4. The price of freedom by Kibo · · Score: 3, Insightful

    I use GCC despite it being a slower compiler. I use XFree86 despite it being a slower windowing system. I use Mozilla despite it being a slower browser. Freedom is more important than speed.


    In this case, instead of paying with your pocket book, you pay with your pocket watch. While your "freedom" might be the only quality you care for, that hardly makes it the only one that matters, as you don't buy all the software. I, and many others, are as uncomfortable with your trade-offs as, you must be with ours.

    --
    --Jimmy has fancy plans; and pants to match.
    1. Re:The price of freedom by nathanh · · Score: 3, Interesting
      In this case, instead of paying with your pocket book, you pay with your pocket watch.

      This is the same false thinking that leads people to buy faster computers because "3x faster means 3x as productive!". It's a lie. People are slow. Computers are fast. Software needs to be fast enough, and no faster. This applies to desktop applications just as much as server applications.

      For all the increases in computing power and speed, is the NT fileserver with 1Gbps fibre any more productive than the Netware server with 10Mbps ethernet? It should be clear that the increases in speed have not led to productivity increases nor cost reductions. The real cost reductions would have been achieved if the Novell server had been replaced with Linux + Samba in the first place. That would have broken the hapless administrator out of the proprietary lock-in that both Novell and Microsoft are trying to achieve. The minor decrease in functionality/quality at the time would have been long-term offset by the huge increase in freedom. That's a freedom that the administrator would have forever.

      The same argument applies here for Direct3D vs OpenGL. The short-term benefit of increased speed with Direct3D in low-importance applications(ie, games only) is long-term offset by the huge increase in freedom for developers and users with OpenGL. On the list of "features to compare" the feature of freedom should be given a high weighting value. In the long-term the cost of freedom is greater than any minor increase in speed.

      While your "freedom" might be the only quality you care for

      It isn't. Cost, quality, reliability and fitness for task are all important decisions when purchasing hardware and/or software. The cost of freedom is not equal to the cost of money.

      as you don't buy all the software.

      I'm sure you don't either, but I do buy some software. When there is a decision to be made then sometimes the proprietary software wins out. In the case of Direct3D vs OpenGL the cost of freedom greatly outweighs the minor advantages of 5% greater speed for a video game (the only 3D field where Direct3D has any true relevance).

    2. Re:The price of freedom by Kibo · · Score: 3, Interesting

      It is what it is. 3x faster isn't always 3x times more productive, or 3x whatever. While people are slow giving computers tasks, sometimes those tasks can be enourmously complex and take the computer a while to accomplish. Hybrid radiosity solutions and volumetric redering come to mind. In fact, my brain can figure out what it should look like in seconds, it might take me a week to tell the computer how to do it, and it might take day for the computer to actually accomplish the task I set before it. My record is 48 hrs to render a single frame. Do I do it profesionally? No, I can't texture or light a scene to save my life. But, for whatever reason, I enjoy it. However, I do not find it enjoyable to wait 2 days, for a frame. In this case, processing power directly, and linearly affects my "productivity". But that's one of a billion instances.

      While there is a certain charm to the marxist simplicity you seem determined to frame the problem in, yet if it were accurate the market really would reflect this. It's not just doomed dot coms that had the gig ethernet. If a P90 with 16 MB ram, a 528 MB hd, and a 10 Mb card really did the same job as an array of xeon web servers, no one would ever use anything else.

      The people have voted, they've decided not every problem looks like a nail. They've decided they need a wide variety of unix varients. They've decided they need some things that are free, and some things that require spot inspections from microsoft, and help desk contracts from sun. They decided against one kind of shoe, no matter how efficently produced, for all the people.

      But it doesn't apply to games anymore than it applies to shoes, or any other good. Games are important, many billions of dollars important. They cut into TV ad revenues, they cut into school for some (I used to know a guy who had to take a quarter off school because of Quake I), they entertain, and sometimes train. If they truly were superfluous, they would be treated as such. They're not.

      You may not think much of them. But that is your individual subjective experience. While that is representative of some segment of the population, you cannot say it is a feature that is true for a large fraction, let alone a majority of the population. More over, I mostly encounter the choice when I putter around in trueSpace 5 since I have the choice of OpenGL or D3D enviroments. When I first got trueSpace 4, OpenGL was a better choice, now, in trueSpace 5, D3D seems more responsive. And contrary to what you find, I happen to prefer a responsive user interface. But in my defence there was a time when I considered lynx to be the best web browser, and emacs the best text editor and with bbdb the best contact management software anyone would need. Obviously I was an idiot. But, it certainly was responsive.

      What's important is the only opinions that count are the one people are willing to spend resources on. Since you're not the only person spending resources, your's is not the only opinion of worth. In the end, the cost of everything is measured in dollars, or whatever the local currency might be. In fact, the only thing one cannot really buy is time. We've only got about a billion heart beats each, if you choose to spend some waiting, I choose to spend some making accurate 3d models that look butt ugly, and someone else chooses to spend some fraggin people he doesn't know in 1920x1600 photo real glory, to each their own. That's really what freedom is after all.

      --
      --Jimmy has fancy plans; and pants to match.