1
\$\begingroup\$

Why would a game developer choose to use Direct3D (D3D), instead of using something with more cross-platform support, like the Vulkan or OpenGL APIs?

I know the hardware is actually rendering.

\$\endgroup\$
  • 1
    \$\begingroup\$ Probably the tools they're using, and whether or not they intend to get everything else working cross platform. \$\endgroup\$ – Almo Mar 4 '17 at 15:14
  • 2
    \$\begingroup\$ Already answered elsewhere: softwareengineering.stackexchange.com/questions/60544/…; OpenGL isn't actually cross-platform at all, by the way; none of the major/AAA-target consoles use it. \$\endgroup\$ – Maximus Minimus Mar 4 '17 at 15:41
  • \$\begingroup\$ @LeComte how does that make it not cross platform? Not 100% cross platform sure but still cross platform. Isn't it supported on Wndows, Linux and Mac? \$\endgroup\$ – Richard Tingle Mar 4 '17 at 17:24
  • 1
    \$\begingroup\$ @RichardTingle - by the same argument D3D is also cross-platform. \$\endgroup\$ – Maximus Minimus Mar 4 '17 at 18:08
10
\$\begingroup\$

OpenGL is available on many platforms, but that doesn't magically make it a effort-free cross-platform option. There are still many platform variances and platform-specific hitches that somebody using OpenGL has to account for when building a project that will be deployed to many platforms. Initial setup, hardware capability, and driver bugs or implementation details are chief among these concerns.

Certainly using something like OpenGL will reduce the burden of porting to many platforms, but it doesn't completely eliminate it.

With that in mind there are often several reasons that go into a decision to use D3D over OpenGL:

  • The developer just likes the API better and would prefer to use it when possible.
  • The developer doesn't actually care about current or future portability concerns.
    • Or the developer may not know OpenGL and doesn't have the time or desire to learn.
    • Or the developer might not think it's worth porting to other platforms due to market share.
    • Or the developer might not have access to any hardware other than a Windows PC.
  • The developer wants to use the "best" (most performant, most well-supported, whatever) API on every available platform and the cost of maintaining both a D3D and OpenGL (and Metal... et cetera) renderer is worth it to that developer.
    • Also related to this is the idea that the developer may be porting to something that neither OpenGL or D3D run on, such as a console; at that point they have to pay the cost of building or using an abstraction anyway.
  • The developer might be using existing frameworks that make the decision for them.
\$\endgroup\$
  • \$\begingroup\$ The other option is that the programmer may be getting money from the maker of that API to use that API? (Like big gaming companies) \$\endgroup\$ – user96759 Mar 5 '17 at 15:06
  • \$\begingroup\$ @user96759 That's theoretically possible, but I have never experienced that kind of scenario (for rendering APIs, at least) in more than a decade of working in the industry. Microsoft does engage in exclusivity deals, but that's based on platform (the Xbox platforms for example), not rendering API. Khronos is a non-profit and has never, to my knowledge, paid a developer to use the API they design exclusively. \$\endgroup\$ – Josh Mar 5 '17 at 16:02
  • \$\begingroup\$ Kickbacks for using a rendering API seems highly unlikely, though it's mere speculation. There's not really a profit motive for that granular of a kickback. \$\endgroup\$ – Jesse Williams Apr 27 '17 at 20:09
4
\$\begingroup\$

This is a rather broad question & the specific answer will vary from one situation to the next. Here are some general reasons:

  • It takes less time, money & expertise to develop & support a more restricted platform than a broader one.
  • You might be using a specific engine, tool or library that's tied to a given platform / API.
  • Your development team might not have experience with Vulkan or OpenGL.
  • You might personally prefer one API / platform over another.
  • Your publisher might have restrictions on platforms they're willing to support.

Ultimately, if you have the luxury of having enough time & or money, you can work around any of the above problems, use whatever tool you want & release on as many platforms as you'd like. In practice, you probably have some constraints that affect your choices.

\$\endgroup\$
4
\$\begingroup\$

The answers in this thread all make good points that play into this decision, but a few more things to consider:

  • Windows comes with DirectX built-in and the driver certification includes Direct3D support. OpenGL support built-in is limited to software OpenGL 1.5, so anything beyond that requires 3rd party installers & drivers. These are widely installed by OEMs, but that doesn't mean OpenGL 2.0 or 4.0 will 'work out of the box' the same as DirectX. So, the edge for supportability on Windows systems goes to DirectX.

  • OpenGL includes a very wide ranging amount of functionality including a lot of legacy functionality. Direct3D tends to trim out this older functionality over time. For example, Direct3D 10 or better doesn't include the old fixed-function hardware transform & lighting and texture blend cascade functionality, and just supports programmable shaders. As such, it can be challenging to know exactly which parts of OpenGL to optimize the most and this is a shifting target. Video driver writers tend to focus on a few key OpenGL games and applications, and if you're usage pattern doesn't match it you may well hit bugs or performance cliffs. For a while in the 1990s, your OpenGL game had to do exactly what DOOM did on Windows to work well. It's better these days, but the edge for compatibility on Windows systems goes to DirectX.

  • Finally OpenGL tends to be very 'vendor-specific' in the implementation details. A lot of effort from Microsoft goes into making DirectX work well across all vendor's devices, so it tends to be more 'hardware neutral' than the equivalent OpenGL which usually has to use a lot of specific extensions. This is the natural result of the fact that hardware vendors want product differentiation, while software developers want abstraction and consistency.

Ultimately for successful games and engines, the question is not which one to support but which one to do first because successfully popular IP will be shipped on many platforms including those that only support DirectX, and those that only support OpenGL or OpenGL ES.

\$\endgroup\$
3
\$\begingroup\$

Because this is not actually as important as you seem to think it is

OpenGL (or Vulkan) is not a magic bullet for cross-platform support; in fact supporting multiple rendering APIs on different platforms is a solved problem, and has been for many years. Look at any game that's released for both XBox and Playstation: that game has already solved the problem; it supports two APIs. Does it also have a Windows version? If so then it has support for three APIs.

What's far more interesting than different software platforms is different hardware platforms, i.e. different GPU vendors, or even different hardware revisions from the same GPU vendor. This is where Direct3D has a number of distinct advantages over OpenGL, including (but not necessarily limited to):

  • Developers code to a common runtime so differences between hardware vendors are better abstracted.
  • OpenGL typically evolves by means of vendor-specific extensions, meaning that (until the spec settles down) you may have to write multiple different code paths that do the same thing.
  • Direct3D tends to give you a better indication of what is actually supported by hardware, whereas OpenGL is allowed fall back to software emulation, which can be too slow to be practically useful (anybody who tried to use non-power-of-two textures on the first available OpenGL 2.0 hardware has bitter experience of this).
  • There is typically a good match between Direct3D versions and hardware generations; this was particularly the case for the DirectX 8/9/10 and GL 1.5/2.0/3.0 generations, where Direct3D actually had significant features (such as buffer objects and shaders) in a cross-vendor form before OpenGL did.
  • Direct3D driver quality and tools tend to be better.
\$\endgroup\$
1
\$\begingroup\$

It is a mix of target market and developer convenience:

  • According to Steam Hardware & Software survey as of March 2017, 95.96% of Steam users are running windows which supports DirectX.
  • All generations of XBox also support DirectX exclusively.
  • Other consoles use proprietary APIs (Some have partial OpenGL API support with drawbacks.)
  • Many GPU drivers on Windows have major bugs in their OpenGL implementations.
  • OpenGL documentation and API is often ambiguous and difficult to understand.
  • There are API wrappers that use OpenGL and provide a DirectX interface to (relatively) easily port DirectX games to OpenGL platforms.
  • OpenGL does not standardize the display initialization, just the rendering.

The biggest advantage of OpenGL is if your target market are Unix workstations (OSX, Linux, BSD, etc) or mobile devices using OpenGL ES and want it to also run on PCs during development.

\$\endgroup\$
  • \$\begingroup\$ This answer makes some good points; but they are not fleshed out enough, and could easily provide supporting documentation, but do not. \$\endgroup\$ – Gnemlock May 7 '17 at 6:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.