
Why you should use OpenGL and not DirectX - intull
http://blog.wolfire.com/2010/01/Why-you-should-use-OpenGL-and-not-DirectX
======
taspeotis

        API use was shifted in favor of DirectX
        by Microsoft's two-pronged DirectX
        campaign around the launch of XBox
        360 and Windows Vista, including the
        spread of FUD (fear, uncertainty and doubt)
        about the future of OpenGL, and wild
        exaggeration of the merits of DirectX.
    

I thought it was because that, at the time, the OpenGL API was shit [1].

    
    
        By the time of OpenGL 2.1, OpenGL was
        running into a problem. It had a lot of
        legacy cruft. The API wasn't easy to
        use anymore. There were 5 ways to do
        things, and no idea which was the fastest.
    

And really, the author of the blog post should have known this when the blog
post was written...

    
    
        By David Rosen on January 8th, 2010
    

OpenGL 2.1 came out in 2006 [2].

[1]
[http://programmers.stackexchange.com/a/88055/7067](http://programmers.stackexchange.com/a/88055/7067)

[2]
[http://en.wikipedia.org/wiki/OpenGL#OpenGL_2.1](http://en.wikipedia.org/wiki/OpenGL#OpenGL_2.1)

~~~
kbenson
That stackexchange post is very, _very_ good. Points just for bring that out.

~~~
guiambros
It was a great read, indeed.

And yet, it was locked by SE mods as out of topic. While I love Stack Exchange
and I'm thankful for the value it brought in so many ways, this policy of
locking reasonable and valid questions is just upsetting.

------
pjmlp
Again that post. Spreading the lie that all game consoles support OpenGL.

Yes, OpenGL is a great API if one cares about portability and FOSS.

Reality, the game industry cares about their IP and getting games released no
matter what technology stack is used.

Many AAA studios don't even develop for all platforms, rather target a main
one, leaving the port to subcontractors.

Back in the golden days of the arcades, many subcontractors were not even
given source code. There are plenty of subcontractor stories about having to
play through games while taking pictures or recording on tape.

When you have development processes like this in place, the gaming API doesn't
matter that much.

~~~
exDM69
> Many AAA studios don't even develop for all platforms, rather target a main
> one, leaving the port to subcontractors.

AAAs are one thing and are mostly based on engine technology that has been in
development for years. For them D3D vs. OpenGL is a non-issue that was solved
a decade ago. Or they stick to being Windows only. And they have the budget to
port (or hire a subcontractor to port) one way or another.

For indies, on the other hand, the most money these days is (probably, don't
have any stats at hand) coming from Android and iOS, which both use OpenGL
(ES). Using off the shelf game engines is a very popular option but a lot of
developers roll their own tech.

~~~
kevingadd
Your statement that the most money comes from Android and iOS is not really
supported by the facts for a typical indie. F2P requires a lot of
investment/luck and non-F2P on mobile is a steadily shrinking market. Many of
the big indie successes are PC titles sold on Steam or console titles.

I'm sure you can find some examples of mobile successes that brought in big
money for a small indie studio, but I'd be shocked if you could find even half
as many as you can if you look at PC and console.

It's worth pointing out that desktop GL and mobile GL ES are pretty
significantly different (extension support, API, compressed textures, etc),
too.

~~~
benzor
> _F2P requires a lot of investment /luck and non-F2P on mobile is a steadily
> shrinking market._

I've been an independent developer for a year now, and having just launched
our first game I can really echo that this is how we feel about the App Store
too. You can rank in the "top 100 highest grossing games" for a multitude of
countries and still make absolutely no money on a F2P game... we've been
there. And various articles back up this "winner takes all" vibe [1].

[1] [http://www.whiteboardmag.com/the-one-percent-winner-take-
all...](http://www.whiteboardmag.com/the-one-percent-winner-take-all-web-
positioning/)

------
AshleysBrain
Isn't mobile and the web the decider these days? Article is from 2010, but
consider if you want to develop 3D on any of these platforms:

iOS - OpenGL ES

Android - OpenGL ES

Mac - OpenGL

Linux - OpenGL

HTML5 - WebGL (based on OpenGL ES) - even in IE!

Emerging platforms like Tizen, Firefox OS - OpenGL ES/WebGL

DirectX is just for Windows and Windows Phone. Isn't it getting to the point
where the bother of having to write a DirectX port might cause developers to
skip the Windows platforms, or stick to OpenGL on Windows desktop? Windows
isn't as overwhelmingly important as it used to be, and couldn't the fact that
DirectX is different start to work against MS? Imagine if Blackberry came out
with their own custom 3D API - wouldn't that only serve to hurt them?

~~~
EpicEng
Yeah, if all you care about is candy crush and the random pay to win adventure
game. No one is playing "real" games on tablets or phones, nor will they be
anytime in the foreseeable future.

~~~
MBCook
> No one is playing "real" games on tablets or phones, nor will they be
> anytime in the foreseeable future.

Could you explain that? I've played some pretty great games on my iPhone/iPad
over the last few years. There certainly are games that could stand up to the
average PC release (remember BattleField 7 and Call of Duty 18 are not
_average_ ). Many are at least easily comparable to games of the 16 bit era.

A sample from my purchased apps list: Battleheart, Beat Sneak Bandit,
Brainsss, Device 6, Fieldrunners, Edge, Game Dev Story, Girls Like Robots, One
Tap Hero, Punch Quest, The Room, Slayin, Spider, Spy Mouse, Star Command,
Supermagical, Tiny Heroes, Tiny Thief, Waking Marks, and Zenbound.

This doesn't include 'tiny' games, ports, digital version of boardgames, etc.

~~~
EpicEng
All of your examples are casual games.

WoW, Rift, Guild Wars, SC, competitive FPS's, Witcher style RPG's, Elder
Scrolls, etc. these are not games you will be playing on a tablet. There
exists a clear divide between casual and serious gamers.

I don't mean to imply that there's anything _wrong_ or inherently inferior
about the more casual side of things, just that they really are two very
different markets.

~~~
tripplethrendo
You can play WoW and Guild Wars 2 on a Mac. Doesn't that mean they are OpenGL?

~~~
ahomescu1
Guild Wars 2 uses Wine internally to run the Windows GW2 client (I used to
play it, and I'd occasionally get Wine errors).

------
kayoone
Isn't this more or less a problem of the past?

Today with tools like Unity3d, UDK, CryEngine, Shiva Engine, MonoGame etc,
game developers are at a point where they can pretty much stop worrying about
the OpenGL/DirectX layer beneath their engines. Those Engines have become so
powerful and affordable that it hardly makes any sense to roll your own. In
fact, imo you would need a very strong reason to build your own engine these
days instead of focusing on your product.

Soon all of these will support WebGL/HTML5 as a target and even render most of
the (still very basic) WebGL engines obsolete.

Now if you were in the business of creating your own tools or engine, you
would need to support both of OpenGL and DirectX to be able to support all the
major platforms anyway.

~~~
exDM69
> Isn't this more or less a problem of the past?

Yes and no.

If you want to be writing a typical 3d game like an FPS, and RTS or 3rd person
platformer, you can and probably should use an off the shelf 3d engine and
stay away from the lower level APIs, OpenGL and d3d.

However, if you want to do something more exotic, say processing your webcam
input stream with your GPU, or write a space scale render of the solar system
or do anything that diverges from the use cases you typically use 3d engines
for, you might still be better off using D3D or OpenGL directly.

Then there are aspiring future game engine programmers and hobbyists who
_want_ to use OpenGL directly. It's arguably more interesting than paying for
a 3d engine but it's more work of course.

So most people do not need to touch D3D and OpenGL, in the same way that most
people do not need to write C. But some people must and some people want to.

~~~
kayoone
Sure, they are some edge cases where it might make sense, but even then i
would analyze requirements very carefully. I have quite a bit of experience
with Unity3D and besides being really simple to use you can basically extend
it with any C#/C++ library that you see fit. Support for Webcam input streams
is there out of the box and id argue theres hardly anything it cant do.

Of course, if you want to be (or are) an engine programmer, go for it and get
your feet wet using OpenGL/DirectX, but for the broad mass of game developers,
these aren't issues anymore.

Playing with it directly can be fun yes, but it can also be frustrating if all
you want is so much easier with a game engine.

~~~
exDM69
> Sure, they are some edge cases where it might make sense, but even then i
> would analyze requirements very carefully. I have quite a bit of experience
> with Unity3D and besides being really simple to use you can basically extend
> it with any C#/C++ library that you see fit.

Sure, Unity3d is very flexible and has given us some outstanding games. Like
Kerbal Space Program, for example. KSP has quite a bit of modifications to
make Unity3d work for them, they have had to do some black magic to make
Unity3d work in space scale scenes on both, the physics and graphics
departments.

When looking at dev talks given by the KSP team, it begs the question whether
or not they would have been better off not using Unity at all and doing a
specialized engine from scratch. There's no real answer to this question and
Unity probably made their time to market shorter so they could actually ship
and sell the game to keep the development alive. And then they went on later
to rewrite a lot of the stuff they did early on.

But from a purely software engineering standpoint, they might have been better
off not using an off the shelf 3d engine, because there are no space scale 3d
engines available.

Again, for most people it makes sense to pick up an engine and go with it but
there are use cases where it might pay off to invest the time and effort to
build your own tech from scratch.

~~~
girvo
Hindsight on projects is 20/20, and you can't discount the productivity boost
that using something that let's you focus on the _game_ straight away gives
you.

------
frik
This articles is from 2010 and is really dated.

Even Microsoft supports WebGL (based OpenGL ES 2) in Internet Explorer 11.

Beside that the article doesn't mention that OpenGL 2 came late (and 1.x is
way outdated). And to bootstrap OpenGL 2+ on Windows you still need a OpenGL
1.4 context to create an OpenGL 2+ context. So not so trivial at all :/

As the article is pre-smartphone era: the future for OpenGL/WebGL is very good
now. You can run WebGL on every device/OS (beside Windows, OpenGL 2/3 but no
ES driver).

~~~
gtirloni
It's funny how many old stuff (that is supposed to rely on current data) is
posted on HN. I am still getting used to this.

I was reading the article and he mentions WinXP is half of all gamers.. I
couldn't believe my eyes. These things should come with a disclaimer here like
"really really old stuff, i just want to pick a few points from it which are
this and this. ignore the rest".

------
jheriko
this is old, its also wrong in many ways. i keep hearing 'OpenGL' is cross
platform.

This is a quantifiable lie. I have written cross platform rendering engines
and worked with many, I can tell you right now that platform and vendor
specific hacks for OpenGL are a necessary evil if you want your stuff to work
properly.

If you are working in a cross platform environment you abstract away rendering
then whether you are using DX or OpenGL (or anything else - RSX, or
whatever...) is not really important.

The question I always wonder is why OpenGL isn't this... if I can make it so
can anyone else, absolutely. Its not hard or especially time consuming and
gives you the power of actually being cross platform.

This is a constantly improving situation though... for example I no longer
need to tell a large number of Intel graphics cards that clockwise is infact
counter-clockwise for face winding - because they are obsolete and the drivers
have improved. There are still many problems of that nature though... you
might not realise that the driver is processing your vertex shader on the CPU
for instance which makes for a significantly different performance profile to
similar hardware in that class...

------
Tloewald
The big problem for OpenGL was (a) Windows platform dominance, particularly in
gaming, and (b) weak support for rapidly improving 3D hardware (but that was
largely a case of already in progress network effects -- OpenGL drivers suck
because very few people care, so even fewer people use OpenGL).

OpenGL was kept on life support in the aughts by high-end 3D products which
are often cross-platform (e.g. Maya), and Apple (which switched to OpenGL from
QuickDraw 3D after the spectacular failure of the latter -- incidentally
OpenGL being "open" was SGI's proactive defense against QuickDraw 3D), and
then rebuilt the entire Mac UI architecture on top of it.

OpenGL ES and iPhone have completely revived OpenGL's fortunes -- there's
nothing much to worry about now unless Android and iOS both fail in the
marketplace.

(It's entertaining that the Stackexchange post linked elsewhere was written
more-or-less as a final "this is why OpenGL died" \-- it's not dead yet...
getting better...)

------
treeform
It feels like a lot and nothing has changed since that 3.9 year old blog post.
On one had webGL, steamOS, Mac games, iOS games, and Android Games. On the
other hand gaming PC is still a windows PC. What are your thoughts?

~~~
goldenkey
DirectX has a way better API which might be why. DirectX has been COM
oriented, OOP design, for years. While OpenGL was handle-based, purely
procedural.

~~~
pjmlp
Yes, many that bash DirectX never experienced how the whole ecosystem works
and the existing offers in terms of tooling for performance analysis.

~~~
exDM69
> Yes, many that bash DirectX never experienced how the whole ecosystem works
> and the existing offers in terms of tooling for performance analysis.

Usually people don't "bash" DirectX or D3D. Most OpenGL programmers
acknowledge that it is a better API with more corporate backing (ie. budget).
But at the same time it is still Windows only, and for a lot of people it
simply isn't an option.

For OpenGL, the tooling is provided by individual vendors, and yes, it's not
as good as d3d. But the situation has improved in the past few years and keeps
on improving.

~~~
pjmlp
Which vendors? Besides gDEBugger there isn't any tool that I am aware of, that
can match the performance monitoring of DirectX and console specific APIs.

Even NVidia only started to invest in OpenGL performance measuring tools,
after their Android support started.

~~~
exDM69
> Which vendors? Besides gDEBugger there isn't any tool that I am aware of,
> that can match the performance monitoring of DirectX and console specific
> APIs.

Yes, there probably aren't tools that are as good as the D3D tools. But
Nvidia, AMD and Intel have all released OpenGL profiling and debugging tools.
Yes, every vendor has their own tools. Not ideal.

------
Shish2k
A series of relevant tweets from
[https://twitter.com/wolfire](https://twitter.com/wolfire) :

My old OpenGL vs Direct3D post is #1 on hacker news!
[https://news.ycombinator.com/item?id=6852961](https://news.ycombinator.com/item?id=6852961)
Maybe time for a 2013 update -- a lot has changed since then.

1\. D3D 11.1+ only supports Windows 8, which only 20% of Steam users have.
OpenGL 4.4 works on all versions of Windows.

2\. NVIDIA and ATI both now have good profiling and debugging tools for OpenGL
that were formerly only available for DirectX

3\. OpenGL Core is now lean and mean, making it easier for hardware vendors to
create efficient and correct drivers.

4\. Valve now strongly supports OpenGL with their own games and with SteamOS
-- helps ensure the future of OpenGL itself, and vendor support.

5\. Humble Indie Bundle creates an extra commercial incentive for indies to
support Mac and Linux, which is much easier if you use OpenGL.

6\. All the old points still stand -- OpenGL works on Mac, Windows, Linux,
Web, iOS and Android. Direct3D only works on Windows and XBox.

~~~
info128
These are all good points, however, another very important point is driver
quality / vendor support. For non-hardcore gamers, it is not uncommon to run
Windows default drivers, which often have very poor OpenGL support and/or
performance. I would love to see the Steam hardware survey list vendor
provided vs driver support for OpenGL.

I think developers may be driven away from using OpenGL at least partially
based on worry about driver support. Using Windows this is a non-issue if you
stay within DX10 and Windows 7/8\. According to Steam Survey, this accounts
for 81.61% of users. This drops down to 56.2% for DX11.

In short, until vendor OpenGL driver support is a given, many developers will
stick with Windows and Direct3D.

Another note, this one on cross platform compatibility - the limitations of
OpenGL ES2.0 are problematic for anything beyond rudimentary shaders. The
primary limitation right now in my mind is a shortage of uniform vectors, and
the wide variance in size for different android hardware. For instance, a
smooth skinning (matrix pallet) shader for skeleton-based deformation will be
limited to 5 or 6 joints per mesh on most android/OpenGL ES devices, whereas
most x86/OpenGL systems allow for hundreds of joints. Similar limitations
apply to pixel shaders as well - post processing such as blur, bloom, dof, and
SSAO are not feasible on current generations of android devices for production
use.

Of course android device GPUs are getting much more powerful with each
iteration, and eventually will provide a good hardware base for advanced
graphics engines.

For now, though, the idea of porting a full OpenGL graphics engine with
advanced shaders to OpenGL ES2.0 is pretty much a re-write of the engine.
This, combined with limited CPU and memory performance, is the primary reason
we don't see AAA titles showing up on Android devices yet.

A lot is coming down the pipe in terms of hardware advances, though - I'm
excited to see OpenGL support grow in parallel.

------
be5invis
One of my friend, a game developer, said that, once you get familiar with the
DirectX 11, you will not want to use any other APIs. They look outdated.

And seriously, the GNMX API (a high level wrapper of GNM) of PS4 has more
similarity to DirectX than OpenGL.

~~~
girvo
Game developer, or engine developer?

------
girvo
I'm amazed at the comments here on this thread... Personally OpenGL is
strictly superior to DirectX, solely due to being cross platform. With the
release of the Steam Box and a push from Valve to look at Linux as a first
class target for games, hopefully we'll see development proceed to create
better tooling to rival that and exceed DX.

This is good for all of us consumers, as the lock in inherent to the
technology choices made my game devs will be diminished. I can only see that
as a good thing.

And besides, middleware is getting so good, how many of us really need to hack
on an engine anyway. My games logic is done in Lua, not C/OpenGL :)

~~~
Narishma
I don't know of anyone who does game logic in OpenGL.

~~~
girvo
That was my point, I was being snarky. Man, text totally is the worst for that
sort of thing...

------
ewzimm
For a 4-year-old post about the progress of Overgrowth, it doesn't really
convince me to use OpenGL, considering that Overgrowth is still in alpha. It's
a 4-person team and an ambitious game, so I'm sure it's not related to OpenGL
use, but it's still kind of funny.

------
jasin
Portability etc notwithstanding and purely from an API point of view, there's
no question that DirectX is superior to OpenGL. There are lots of examples,
but the mere fact that you need _another_ 3rd party API such as GLEW even to
be able to use OpenGL's latest features in the first place should speak
volumes.

~~~
vetinari
You don't _need_ GLEW, it is just convenience library.

~~~
jasin
Well, of course you don't _need_ it. You can always go and parse the extension
string yourself, then call LoadLibrary() and GetProcAddress() to manually
setup pointers to the extension functions etc. The point is that you don't
have to care about any of that crap when using DirectX. Bear in mind, this is
just one example.

~~~
vetinari
In DX you have to care about version and capability bits (up to DX9) or speed
(same caps, some may be implemented in software, DX10+). Same thing in
slightly different way.

------
kayoone
As a sidenote, Wolfire is currently working on
[http://www.wolfire.com/overgrowth](http://www.wolfire.com/overgrowth) which
is quite impressive in terms of game mechanics. They also post development
videos on Youtube regularly which i find highly interesting:
[http://www.youtube.com/WolfireGames](http://www.youtube.com/WolfireGames)

~~~
frik
Yes, but thanks to their HumbleBundle.com success, over the years Overgrowth
looks more like a engine tech demo and vaporware.

~~~
Erwin
They seem to be happy to let you pay $30 for the Alpha version though, despite
it being in Alpha since at least 2009 (based on the date on the FAQ). I'm
surprised PayPal will let you pre-order something that has been more than 4
years in development and has no release date.

~~~
Tmmrn
On the one hand you keep reading "developers need to eat" and on the other
hand you keep reading comments like yours.

Buying the alpha means paying for continuous development...

Also, you get a new download of the current state every time they have some
significant changes.

~~~
Erwin
I've backed around 40 KS projects. I'm happy to microfund projects that have a
realistic timeplan. I think if you're selling alpha access to something that
has been in development for 4+ years and doesn't seem to have a clear time
plan for completion, maybe you need a disclaimer -- especially when dealing
with PayPal, which is infamous for being strict about what you can sell
through it.

------
romanovcode
>However, there's one big problem: they don't work on Windows XP! Half of PC
gamers still use XP, so using DirectX 10 or 11 is not really a viable option.

This problem does not exist anymore.

~~~
voltagex_
I know what you mean but
[http://store.steampowered.com/hwsurvey](http://store.steampowered.com/hwsurvey)
still shows 14.63% on XP - not a huge amount but still hanging on.

~~~
shootinputin
Windows XP 32 bit 6.17% -0.26 it says

------
spikels
And since this article was written Microsoft has pretty much admitted defeat
by incorporating WebGL (a simplified version of OpenGL) in IE11.

~~~
kevingadd
There's no way they ever would have exposed DirectX to JavaScript. It's not
really admitting defeat to implement a web platform feature that customers
want when you have no alternative.

They used to be pushing Silverlight as a way to do 3D rendering (which made
sense, because it had the DirectX bindings from XNA and .NET is a superior
platform for rendering code when compared with JavaScript) but now that
Silverlight and basically every other native plugin is on the way out, there's
no way they can lean on that anymore.

~~~
rbanffy
Exposing DirectX to JavaScript would be like allowing the browser to run
VBScrpt code. They tried.

~~~
bitwize
There was a time when Internet Explorer _could_ run VBScript code... you said
<script language="VBScript"> ...

What I think you mean is letting the browser run scripts in the Windows
Scripting Host, which gives you unlimited access to the filesystem, etc.

------
davexunit
You should use OpenGL because DirectX is proprietary and only available on
proprietary operating systems. Simple as that.

------
GnarfGnarf
Why does Unity use DirectX on Windows, and OpenGL elsewhere?

You'd think once they went to the expense of porting to OpenGL, they'd re-use
that code on Windows? Or is it because they get better performance with
DirectX on Windows?

~~~
pjmlp
They get better performance and more stable drivers.

Many cheap computers have GPUs with shitty or non-existent OpenGL drivers.

------
JimmaDaRustla
Microsoft use to be on the OpenGL board (I believe in the 90s?). OpenGL was
geared towards scientific development, and we know Bill Gates wanted PC to be
gaming platform. OpenGL at the time wasn't good enough, nor were they willing
to make the necessary changes to meet Microsoft's goals.

DirectX was born out of necessity, not proprietary greed.

Edit: Maybe its time to take another look at OpenGL - open is better than
closed, especially for the multi-platform aspect. But does it have the same
features as DirecX? Tesselation, shader programming, etc.

~~~
seabrookmx
> shader programming

Of course it does. Even OpenGL ES 2.0 and WebGL (based on the same API as ES
2.0) do as well.

The fixed function pipeline of old has been deprecated in recent versions, so
you don't have a choice but to use GLSL.

------
dsugarman
Please cite that this was from 2010 in the title. [1] There is a reason why
openGL is the primary library used in research, it is awesome.

[1] -
[http://www.gamasutra.com/blogs/DavidRosen/20100108/86330/Why...](http://www.gamasutra.com/blogs/DavidRosen/20100108/86330/Why_You_Should_Use_OpenGL_And_Not_DirectX.php)

------
b0rsuk
By David Rosen on January 8th, 2010

------
jamra
Could anyone recommend a book on programming shaders for OpenGL? I know the
shader language is not OpenGL, but I never knew where a good point to start
was.

~~~
emddudley
I think any recent book on OpenGL worth its salt would cover shaders in
detail. I've just picked up the OpenGL SuperBible (6th ed.) and it's got
several hundred pages dedicated to shaders.

------
laveur
When was the last time MSFT updated DirectX? I think they killed it off not to
long ago with the release of X and its just part of the OS now.

------
csmuk
Even Microsoft ships WebGL with IE11...

Perhaps they're getting the point?

~~~
mistercow
What choice do they have? The don't have the market share anymore to launch a
proprietary alternative based on DirectX.

~~~
csmuk
Exactly! It's a good thing.

------
remon
"..on January 8th, 2010"

------
blahbl4hblahtoo
Honestly, up until IOS and Android there wasn't a large "cross platform"
gaming market. Now there is and OpenGL is starting to gain more use...the good
thing there is that there are more people writing, buying, and playing games.
(Not that OpenGL is being used.)

These vehement kinds of slashdotty style articles about MS's being this
controlling conspiracy...you would almost think that...gasp...its a large
corporation doing everything it can to make money for its shareholders. I
mean, if the roles were somehow different and Apple were the market leader for
the most popular gaming platform they would be all sweetness and light and no
one would have any reason to complain. (Oh wait...)

It turns out that businesses in that position tend to make "lock in" plays.
This post kind of glosses over SGI's history with OpenGL as if they were only
ever kind and loving shepherds of an open standard that was created to help
children.

Don't use directx cuz "evil" is stupid. If you were writing an application
that needed to be cross platform...like a 3D authoring environment...you would
probably want to look at opengl. (instead of writing your own...) If you were
targeting the windows ecosystem directx has some platform integration features
that are interesting. Tooling and developer experience also matter.

This kind of breathless nonsense is boring and silly.

