Hacker News new | past | comments | ask | show | jobs | submit login
Why you should use OpenGL and not DirectX (wolfire.com)
408 points by intull on Dec 5, 2013 | hide | past | favorite | 175 comments



    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

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


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


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.


It's also a legacy issue: once developers start using DirectX, it's harder for them to go back, and traditionally PC development has been Windows-only (more or less) for many years. Now that the market is becoming fragmented again between different platforms, there is more incentive to go for a cross-platform API than before - and that's where standards matter.


Not really 'legacy' per se either... good luck running OpenGL on Microsoft's consoles or as a ModernUI application! DirectX being a broader and, in my opinion, better designed API certainly doesn't hurt it's adoption either.


What about OSX? Does DirectX work (at all/well) on it? Linux? How feasible is it to program with DirectX on any non-MS platform?

Edit: I guess the point I'm making is, OpenGL runs on non-MS as well as MS platforms (perfectly/badly is another question), but DirectX is locked to Microsoft only. That is what makes it of little to no value for people like me who need to care about cross-platform products and support.


A Microsoft OS still runs on over 90% of the desktop market.


I wonder what the percentage is when you figure the entire "computer" gaming market (eg. consoles, tablets, and phones). I suspect Microsoft's dominance on gaming is (and will become even more) weaker than we believe.

OpenGL seems like a no-brainer for future survival as MSFT platform dominance exhibits entropy.


Is PS3/PS4 development OGL or a proprietary API? Because if it is OGL then yes that makes said API far more useful for sheer amount of access to hardware.


The PS4 uses OpenGL (4.4?).

The PS3 used a proprietary API based on OpenGL 1.0.


So yeah, OGL grows more useful as the PS4 grows its user base. Thanks for the info


False info. PS4 uses a proprietary API called GNM

http://www.eurogamer.net/articles/digitalfoundry-how-the-cre...


The PS4 supports OpenGL, but my understanding is that most non-indie games use libgcm.


Right now, yes. However we do know that this has been changing quite rapidly in the past years so why fall back on the use of this argument?


How about because it's still valid?

What game developer say to themselves,

It looks like in 10 years, Linux and OSX adoption will _probably_ approach 50% market share. Therefore, the best choice for my new game, which will be released in 3-4 years, is to choose OpenGL

I'm not a game developer, but I would bet they are interested in where the market will be in the medium term, and there is no indication Linux/OS X will suddenly dominate within that timeframe.


    On traditional PCs and Macs, Microsoft
    still owns an overwhelming market share,
    with 91.8 percent of all traffic coming
    from Windows-based machines. Among non-
    Microsoft operating systems, both OS X
    and Linux have stalled since October
    2011, hovering around 6.9 percent and
    1.2 percent, respectively.
http://www.zdnet.com/latest-os-share-data-shows-windows-stil...


Market share if one thing, but we are looking at a segment of gamers which may be split differently. Who says there isn't a larger proportion of Linux gamers in that segment, for example? If Humble Bundle is any indication, it looks like the Mac gamers segment and the Linux gamer segment is actually pretty close in size.


> as well as MS platforms (perfectly/badly is another question)

Not all of them unless you count using an OpenGL-to-DirectX wrapper library. "Cross platform" sometimes means writing all the platform specific code yourself.


These questions are the entire point of the article.


Yeah, don't worry about those mobile devices.

We've got plenty of directx support for those too. What are they again? Surface? Windows phone? I think I know one guy who has one.


Not an Apple or Google product? Gotta be awful! Love how people treat competition as something awful when it doesn't follow their own brand loyalty.

Edit: It looks like the authors snark isn't as obvious to others as it was to me. I'm all for cross platform development and doing whatever makes sense your company/brand in terms of development, all my side projects use tools that make them as portable as possible.


He didn't say anything about the quality of Windows RT / Windows Phone products. Sounds like he was just implying that they have a relatively small installed base compared to iOS / Android products. That's pretty hard to argue with.

But... this is not very important anyway. There's no reason to have a "brand loyalty" flame war. Arguing and flaming about this on the internet is not productive. Let's just have a practical discussion about how to target multiple mobile platforms.

If I was serious about writing a cross-platform mobile game, I would use some middle-ware like Unity, Unreal Engine, Cocos (yes there is a version for Windows Phone), etc. This takes care of the underlying differences between OpenGL ES and Direct 3D, so the developer can focus on the game itself and not worry too much about the rendering engine or graphics API.

If I was writing some other app that used OpenGL ES, I could still make a port for Windows Phone / Windows RT by using a wrapper for the graphics-specific code. Such wrappers already exist, and it is not too terribly difficult to roll your own if you prefer.

A lot of times, when you see a big game that is available on iOS, Android, AND Windows Phone / RT, usually they have done this:

- Use middle-ware as discussed above already

AND / OR:

- Write the majority of the logic in C++ (all of these platforms have ways of utilizing C++ code), and use a graphics wrapper that isolates the rendering code, so you can work with OpenGL ES or Direct 3D interchangeably.


No one was making a qualitative judgement against Windows Phones, just a quantitative comment about install base.


Agreed, someone applying similar snark in a OS X or Linux story would be quickly downvoted.


This isn't to say you won't possibly need more than just DirectX. But this is to say you quite possibly need at least DirectX.


I suspect there isn't a huge intersection between phone/tablet developers and desktop/console developers. I haven't played a game in a while, but it seems like the two markets are still very different.


One is usually enough for a guy.


I have one of each.


And to continue the story started from the stackexchange post, again the depreciation turned out to be a good decision. Guess what OpenGL ES that is used today on mobile devices and WebGL in browsers basically is?


OpenGL was not in any way shit when DirectX started overtaking OpenGL.

It became so around the time GPUs started being programmed by shaders - prior to that era OpenGL was quite pleasant compared to DirectX, yet DirectX mostly overtook OpenGL


I'm not sure I agree with your last point. With the exception of Direct3D, pretty much everything from DirectX has been deprecated at one point or another and replaced with external libraries that usually originate from Xbox development.


DirectInput, for instance. Over-engineered and badly designed, then virtually abandoned (because who ever gets promoted for fixing bugs? You get promoted for features). Definitely not what anyone really wanted from an input API.


thank you.. this is awesome.


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.


> 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.


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.


> 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...


Many studios use game engines that either abstract away the graphics API or at least greatly simplify it. Building your own AAA engine is quite expensive even if you have a lot of resources.

OpenGL ES 2+ is more like DX10 and less like Open GL.


> Many studios use game engines that either abstract away the graphics API or at least greatly simplify it.

Not only do they abstract away API details, perhaps even provide an api independence layer but they actually make the 3d magic hapen. OpenGL/D3D have no notion of "3d", there are no models, cameras, scenes, etc.

> OpenGL ES 2+ is more like DX10 and less like Open GL.

Not really. OpenGL ES is still like OpenGL. It's a subset of full OpenGL and does not fix the inherent design issues with the API.

Feature-wise OpenGL ES 2 is like DX9 which is like OpenGL 2.1 sans the legacy crap. OpenGL 3 is comparable to D3D10 and OpenGL 4 to D3D11. OpenGL 2.x was the "big change" from the old fixed function pipeline to a programmable shader based pipeline, but nothing was removed or deprecated in order to provide an incremental porting path. OpenGL 3 actually deprecates some of the old features but does not change the API, only removes the old parts.

But the API is still a horrible mess with a global state and weird side effects, even if a lot of stuff was removed. For the programmer, D3D is a lot nicer than OpenGL in many ways and that is unfortunately not going to change for the foreseeable future.

OpenGL gets the job done but it's very uncomfortable to use.


DX10 was noteworthy over DX9 in that it got rid of even emulated fixed functions and went pure programmable, which is why I compare it to OpenGL ES. Microsoft* seems to be much more eager about breaking backward compatibility between DX versions for the sake of cleanliness and performance, which is kind of ironic....

*(disclosure: my employer, but I don't work in this area)


Most successful indies worry even less about multi-platform support, and very few indie developers roll their own tech. A surprising amount of indie games start as GameMaker games requiring porting for any sort of proper commercial release. The more technically proficient indie developers hopped onto the Unity3D wagon given how that engine is general purpose enough for any type of project and had great support for indies early on.

Subcontracting to a porting house is just as common if not more common for indies. If your game is successful on one platform a porting studio will be willing to work for a revenue percentage as indies are much more willing to give away significant percentages. Furthermore publishers are fairly willing to front the money for porting if you have a fully working game already designed and playable no matter what platform it was initially developed for. Indie games rarely push the computation and memory boundaries so porting isn't particularly difficult.

The general case for Indie developers is develop for whatever you're most comfortable and worry about that other stuff once you actually have something worth worrying about. The cost of porting a game is pretty trivial if it's worth porting.


For indies, on the other hand, the most money these days is coming from Android and iOS

I hope Android & iOS are not eating up all the revenue. Some of my favorite indie games fall under Microsoft Studios. Those obviously don't run on Android, and I hope the developers are getting the marketshare they deserve (IMO)


At the time this was accurate, that generation all supported OpenGL in some form...


No it wasn't. Only someone without console development experience can issue such a statement.


right... so PSGL wasn't a thing? I never saw the OpenGL for 360 or touched it, but I was told I was mistaken by a few guys when I mentioned that it didn't exist - it wasn't there at launch but MS added it later (third hand quote)...

ps. google me, i have considerable experience. that doesn't stop me from being wrong or making a mistake, but don't make such brash assumptions.


Sorry for jumping to conclusions, but as you can see from these threads many around here tend not to be aware how the industry works.

Myself, I don't have explicit game industry experience, but I do follow it since the mid-90's, having been a IGDA member, GDC Mag subscriber, paid my attendance to GDCE a few times and do know a few people in German studios.

If I work for the boring IT industry it is mainly for not wanting to deal with crunch time and rather enjoy enterprise benefits.

PSGL is a thing and is multiple times reference in a few Sony papers, but it a mix of OpenGL ES 1.0 with Cg and lacks the performance LibGCM offers.

Furthermore, when Sony asked if anyone cared about OpenGL ES 2.0, no seemed to care that much.

As far as I know the XBox PSGL was more of a proof of concept thingy than a proper API. Also a third hand quote.

The thing is that all those APIs follow an OpenGL like way of doing 3D graphics, but they are all different enough that you end up with multiple code paths.


Were any games written using PSGL?


i wouldn't know. i do remember that psglInit did not 'just work' as expected when I experimented with starting a PS3 engine from scratch - I was going to use it as a time saver, but ditched it quick and just did a proper interface to the GCM/RSX functions.


No, they really didn't.


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?


My hope is that the SteamOS/Steam Machines movement will finally tip the scales in favor of OpenGL. A "killer app" that is fully OpenGL optimised with a delayed or worse performing DirectX port would seal the deal. If only Valve had more franchis3s...


I'd be willing to bet serious money that if Valve released HL Ep.3 with the Steam Box next holiday season, they could upgrade their mattress stuffing from $20s to $100s. Even if they released Windows and Linux versions simultaneously, they would absolutely kill it.


Game consoles - proprietary 3D APIs

OpenGL != OpenGL ES != WebGL, yes they are all based on the same concepts, but require separate code paths and different shader versions.


On Linux (I assume Mac too but haven't tried), you can force yourself to OpenGL ES. In fact, I would recommend it. The nice thing about OpenGL ES is that there is only one main way to do things so it is a lot harder to use something slow like glBegin().


> OpenGL != OpenGL ES != WebGL

Whilst technically true, WebGL is designed to have API compatibility with OpenGL ES (2), which in turn is based off of OpenGL (2). OpenGL ES 3 and WebGL 2 are beginning to emerge and are based off of OpenGL 3. In my experience shaders that work with WebGL will also work with OpenGL ES 2 and OpenGL 2.1. Equivalent versions tend to use the same concepts. On the other hand, code written for desktop (v3+) won't work on mobile, because the desktop version is one version ahead of mobile (and I imagind that it will be for several more versions).


You can more-or-less program to the OpenGL ES API under full desktop OpenGL, since ES is a subset of the full API.


> Game consoles - proprietary 3D APIs

Back in the day that was true, but I don't think that's the case these days. Xbox is obviously DirectX. Wii was OpenGL, and I think Sony used OpenGL as well.


Sony have some shitty support for OpenGL. Any developer worth his salt used Sony's API.

Wii had its own API too, though closer to OpenGL, still wasn't OpenGL.

I'm a huge fan of OpenGL, but evangelists have been spreading misinformation about OpenGL just as much as they accuse DirectX as.


I really don't get how OpenGL support for consoles became such a urban legend.

Anyone that cares about graphics programming on game consoles knows how broken or non existent such support is.


It's because console development is a fairly secretive process. The SDKs are all kept under a fairly tight lid, and unless you either work with it yourself or personally know someone who is willing to spill the beans, you cannot get a good idea of the process.


True, but that is no reason to start spreading the falsehood that OpenGL is everywhere used on consoles, as many FOSS advocates do.

Specially when enough information is actually publicly available for anyone that cares about game development, in online forums, games magazines, conferences and game courses.


To be fair, the reason I though the Wii supported OpenGL was because that's what I thought I read from Nintendo when I was seriously considering writing some homebrew games for my Wii.

As to why and where I gained this misinformation I don't know. But somewhere along the line I've gotten my wires crossed.


Maybe the homebrew libs (libogc) support OpenGL? I doubt that you can use to original Nintendo SDK to write homebrew.


With the game programming being secretive and so many people only being able to discuss it anonymously there should be a way to separate insiders from people who like to pretend to be one on the internet. "PS2/3/4 OpenGL" is one shibboleth we can use for this purpose.


The funny thing is that for the PS you don't even need to be an insider, as Sony makes many of their papers freely available.


Keep in mind that DirectX and OpenGL are first and foremost abstraction layer on top of the GPU. Consoles have a fixed hardware, so you can skip a large part of these and write code directly for the GPU.

I don't know how much still holds for the XBox One, but for instance the XBox 360 version of DirectX is very different from the PC version: it's much closer to the metal and exposes pretty much all the GPU functionalities.

Here is a thread talking about XBox 360 dev: http://beyond3d.com/showthread.php?t=62049


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.


> 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.


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.


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


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


WoW uses OpenGL and it runs like crap on a mac.


Unfortunately there's no good word for the market your parent is talking about. "real" games, "hardcore" games, all have negative connotations, but your parent is contrasting lightweight games to heavyweight games. Angry Birds to Bioshock.


I think that's the issue here too. I would divide things in three. Casual games are often quick or pick-up-and-play. Angry birds, Bejeweled, even things like Peggle or Plants vs Zombies. Most flash/FaceBook games fit in here.

Then there are the hardcore games. Eve Online, World of Warcraft, Call of Duty, Grand Theft Auto, Street Fighter 4, etc. These games often require lots of skill or dedication, and are often big budget titles.

But there is a ton of stuff in between. Games that you might be able to play fast but are very difficult (like Spelunky), that the player can choose how to play (Minecraft or Terraria), that just aren't designed to be highly competitive and difficult (Sly Cooper series, maybe Ratchet and Clank series), aren't hardcore ultra-deep sims (SimCity, Game Dev Story), and many sports games (Madden, NBA2k, etc).

Some people go really deep on some games and play them in a 'hardcore' way. The lines aren't easy as I know many people think World of Warcraft has been dumbed-down throughout the expansions to where it may not be 'hardcore' for many people.

But that's my general taxonomy. Casual, 'normal', hardcore.


Sure, there is a lot of overlap too. It's just that one extreme that I don't see being satisfied by mobile devices any time soon (if ever).


Android != tablets or phones.

Thanks to android being open source people can take it and build ...stuff.. with it. I'm sure you have heard of it: http://en.wikipedia.org/wiki/Ouya

And while it's very low-end, there is still stuff like http://www.youtube.com/watch?v=ldwU96PGOyM which might not be a "real" game but it seems pretty close.

Now imagine the next generation of android consoles with OpenGL ES 3.0 and more powerful GPUs.


It might sound like a snide way to put it, but there is a clear dividing line;

OpenGL dominates casual platforms.

DirectX dominates "traditional gaming" platforms.


So the PS2/3/4 are "casual" and not "traditional gaming" platforms?


None of then really support OpenGL though.

While they had OGL implementations, all of them basically require you to write against a low-level proprietary api to be competitive with other games on the platform.


I believe the parent is concerned with PC games, not Console. It's not like most console producers are concerned with cross platform anyway (at least, not until perhaps now, we'll see).


I installed TF2 on my work tablet yesterday, it worked just fine. Civ 5 and X-Com are great on it. Is that "real" enough?


No. Like I have said more than once now, I'm talking about games with complex control schemes that require quick reactions.


iOS XCOM is a great game, is far more expensive than most iOS games, and is has been very successful.


It's not about good and bad, it's the difference between a game like WoW and a game I can play on a touchpad. Very different. The lack of horsepower is an obvious issue, but do you know how many keybinds I have in a game like wow? About 30-40. How about the precision of a mouse and keyboard vs a touchscreen? Screen size (lack of)? Some games are just too complex for these sorts of input devices and there's really no benefit to running them on a portable device. I'm not raiding while outside having a smoke.


Like to put some money on that?

I'd bet money that in two years time 2 out of the top 5 "real" games will be available on iOS and/or Android. (Not entirely sure how we are defining "real" games, though).


I would. It's simply not practical to play games on mobile devices that require more complex input devices which allow for many discrete inputs and more precise control. I don't know, perhaps someone much smarter than I will figure something amazing out, but I doubt it.

And I shouldn't have used the term "real". I'm talking about games like WoW. Many (many) buttons that need to be pressed quickly in response to your opponent (not talking about LFR obviously...).


WoW is a terrible example due to the latency mitigation factors built into the game: you can only cast spells every so often, and then you have a global cool down between spells. You could totally do it on an ipad or some such if the control scheme was a bit better optimized for it.


Those aren't latency mitigation factors, but ok...

So, essentially, your argument is that control schemes should be dumbed down so that they play on mobile? Yeah, that will go over well.


You don't think you are taking your experience of the current control scheme of WoW and projecting it as a limitation of the platform?

I'd note that it's pretty hard to do tilt-control on a PC...

And there are already plenty of actions games on iOS that work well (and need to be more responsive than WoW).


Who needs tilt control? WoW is just an example. Any game that has a complex control scheme and requires quick reactions is simply not suitable to mobile devices. I'm not sure you actually play any of the games I am talking about.


Mobile (or rather touch screens) actually enable richer control schemes than a keyboard. You may not be happy with anything available as yet, but that doesn't make it impossible.

Anyway, iOS controller support means the touch screen isn't the only input device.


Isn't PS4 OpenGL as well?


No. The PS3 had OpenGL ES 1.0 with Cg as shading language, but almost any developer worth his/her salt was using LibGCM.

With PhyreEngine being used as main prototype engine.

Lots of nice technical documents available at http://develop.scee.net/publications

PS4 API is called GNM, http://www.eurogamer.net/articles/digitalfoundry-how-the-cre...


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.


> 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.


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.


> 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.


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.


I know KSP lead designer, they use Unity because of him, he is not a programmer, and knew only how to code more or less with Unity, that he learned on university ( I was student with him ), now they have professional coders, but kept Unity for legacy reasons ( that is: they already started on it, so keep it...)


Not sure I would call it an edge case. It's really a use case. These days, there are many developers who use the GPU for other things than plain vanilla 3D graphics. If there was ever such a thing.

I'm doing a combination of scientific and practical computing, and I'm currently in the middle of the choice of whether to use DirectX or OpenGL. Portability counts, but so does simplicity. It's a very relevant question.


I thought I'd provide an anecdotal supporting example to show that there are valid exceptional use-cases that don't practically fit into a pre-existing 3D engine -- specifically, a 3D visualization of a space-scale procedurally generated universe with trillions of stars and planets.

Several times I tried expanding an existing modular 3D engine (OGRE) towards my goal of displaying a huge virtual universe of planets and stars. While I got it rendering 3D planets after some work (where I basically had to implement manual rendering code anyway, since the engine didn't support the odd use-case of spherical terrain), contorting it to support massive coordinate spaces, huge view ranges, dynamic loading/unloading etc. was just far too messy to even hope to attempt in that engine.

After several attempts to cleanly implement a space-scale engine as an extension of an existing engine, I started over from scratch using pure OpenGL (WebGL). And this time, I managed to keep the code reasonably tidy while supporting trillions of stars, planets etc. as I had originally planned [1].

Would I have been able to do the same thing in OGRE if I kept trying? Probably... but likely with far more ugly code, terrible hacks, bloated engine, and slower loading times.

To be fair, I'm not advocating always "rolling your own" 3D engine. It's usually a huge task, and using a pre-existing engine will in almost every case be the smarter choice. But with some people trying to argue "you can make it fit in [Unity/OGRE/etc]", I thought I'd provide at least one anecdotal counter-example.

1. Kosmos: A virtual 3D universe in your web browser (https://github.com/judnich/Kosmos)


Actually, RTS games are also a hard problem for engines because they require a lockstep shared-state for multiplayer. This means you need a very high level control of the language your game-logic is built in to make sure your floating-point calculations are identical across all devices and everything is perfectly deterministic. This is a problem for "complete-platform" cross-platform engines like Unity.


Lockstep simulation isn't required--though it was a popular solution.


What is the alternative and more popular solution used now?


Abandoning online multiplayer completely.


Ouch, harsh.

Anyways, client-server works fine.


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

Uh, most of those have their core runtime engine written in C++ and are probably not itching to port their CPU-side code to JavaScript.. Porting to WebGL is only trivial for the GLSL shaders, nothing else. If anything, these companies are waiting and holding out for either PNaCl/ASM.js/Emscripten to be able to generate fast fully-working web-compatible engine code.

And those engines aren't just loading 3D models and blit them to the screen, at least that's not their selling point. They have their occlusion culling system .. particle systems .. animations .. hardware audio .. fake wind simulation .. rudimentary pathfinding .. a reasonably fast terrain renderer .. some physics engine intimately integrated into the whole thing.

You wanna port all that to JS? Go right ahead!


Well i was referring to ASM.JS/PNaCL ports as we have already seen possible with Unreal Engine. Its a matter of cross compiling today, not porting to JS.

Of course there will still be usecases for Three.js and the likes, for more lightweight WebGL integrations. But full blown HTML5 games will pretty soon be possible through these engines. Unity3D already had a pretty feature complete Flash export and i am very sure they are already working hard on a html5 target option.


> You wanna port all that to JS? Go right ahead!

It is already done. https://github.com/kripken/emscripten/wiki


It's going to be an interesting race between the Web-native engines and the emulated C++ ones. Some of the WebGL based platforms have come pretty far already, eg. Turbulenz.

The Emscripten based competition only have a few tech demos so far and the possible coming of PNaCl outside Chrome doesn't look that probable at this point.


If you use pNaCl, you can have an Emscripten fallback.


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

You are using Unity 3D, so NO, it's not a problem of the past. You have multiplatform because Unity developers decided to go with OpenGL.


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).


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".


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...


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...)


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?


Most importantly tools like Unreal / Unity3D are so good you almost stop caring if you're running onOpenGL or Direct3D. And this of course is very bad news for windows as the only PC gaming option.


I don't write games, but I certainly do play games. Cross platform titles always run better on my Windows install. Always. So, yeah, Windows for games, I don't really care about the politics.


That's beginning to change, thankfully. I look forward to the day where games are all cross platform without loss of quality.


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.


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


> 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.


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.


> 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.


This is a bit off topic - Do you know a good source (preferably in book form) on development with Direct3D and HLSL? I have been looking, and I'm not really sure where to start. The focus is on low-level shader programming, not drawing 3D models but manipulating 3D primitives. Preferably if it is possible to do using some C# wrapper.


http://www.amazon.com/Introduction-3D-Game-Programming-Direc...

Fantastic book. C++ but you can use SharpDX for your C# development, which complies reasonably closely with the standard DirectX APIs. There are numerous websites/articles only a Google search away to fill in any gaps if/when you get stuck. This is the approach I've been taking. http://nathanridley.com if you're interested.


Thanks :)


A series of relevant tweets from https://twitter.com/wolfire :

My old OpenGL vs Direct3D post is #1 on hacker news! 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.


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.


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.


Game developer, or engine developer?


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 :)


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


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


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.


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.


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


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.


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.


As a sidenote, Wolfire is currently working on 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


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


It's wrong to call it vaporware when after you preorder you can download alpha builds as they come and experience everything shown off in the videos... There's also a small modding community.


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.


It's playable, and you can use the in game editor to make your own maps/scenes. Not too different from what minecraft was when it was early alpha.


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.


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.


Humble Bundle spun off from Wolfire years ago. David is still working on the game full time, he was only involved in the very first Humble Bundle.


I really enjoyed http://www.wolfire.com/receiver . It was done as a part of a 7 day FPS game jam and was a minor hit when it was released.

If you ask me, these guys should have realized the opportunity and work more on Receiver at the time since it had the traction and enough sales to show up on Steam store charts. But there will always be guys who will insist on working their Magnum Opus, and consequentially, there will be vaporware.


>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.


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


Windows XP 32 bit 6.17% -0.26 it says


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


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.


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


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.


Has there ever been a competing option of WebDirectX they could have tried to push instead? Or is admitting defeat in this case the same as admitting defeat by implementing Flexbox?


Silverlight?


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


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?


They get better performance and more stable drivers.

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


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.


> 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.



It does have tessellation support and a programmable pipeline.


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...


By David Rosen on January 8th, 2010


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.


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.


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.


Even Microsoft ships WebGL with IE11...

Perhaps they're getting the point?


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


Exactly! It's a good thing.


"..on January 8th, 2010"


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.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: