OpenGL vs DirectX

Just starting this to jumpstart a discussion regarding graphics APIs

As most of you know, I’m a Mac user (or Macfag, for the lesser evolved creatures roaming these boards), and Macs use nothing but OpenGL, this is mainly (solely?) because DirectX is (one of the few of) Microsoft’s main strong points.

Khronos (the developer currently working on OpenGL) dropped the ball on a lot of occasions in the past by making promises, but breaking them soon after, because of this, they stepped on a lot of big-shot toes: they pushed away CAD, pushed chased away 3D rendering, they pushed away games… They kept on pushing up until the point where OpenGL just wasn’t offered anymore for over 80% of the games or 3D applications. Because of this, OpenGL started lagging behind, getting outdated and losing support from both ATI and nVidia.

But now it feels as if OpenGL is making a return. Khronos has just announced OpenGL 4.1, and essentially, it’s on par with nearly everything DirectX has to offer, so in that aspect, there’s no more difference between both APIs. But OpenGL is still inferior, mainly because of the lack of support by ATI and nVidia, because without support of those two, there would be no optimized drivers, and without optimized drivers, OpenGL will always be the ginger kid of the family.

But back in April, Valve released Steam for Mac, along with a fair chunk of their Source games. Due to Mac’s OpenGL fetish, Valve adapted the Source engine to work with OpenGL. The result is that the Source engine is working just fine, but with a 20-30% difference in performance compared to the Windows version of Source (and thus DirectX). Valve claimed that they are actively working with Apple, ATI and nVidia to bring the performance of both platforms on par. And yesterday, the first signs of improvement have hit the developers in the Apple Developer Program. Apple released new graphics drivers provided by ATI and nVidia. The first results are quite spectacular in my book.

First, this is a screenshot of GL View from before the update, notice the right column with pretty damn shitty performance (on a Radeon HD 4850, 512MB ):

This is a screenshot of the same test in GL view, same settings, but with the new graphics drivers (performance was doubled or even tripled):

If the performance boost shown in that test makes it to the performance of games, there’s a fair chance that OpenGL may even outdo DirectX in its current form.

Do note, however, that there is nu 4.1 support in OSX for OpenGL, so it only goes up to 3.1 (that test only goes up to 3.0, for some reason).

So, are the days of DirectX’s gaming superiority over?

Nope, they’re not. Although I have to admit that nowadays both dx and ogl have 'bout the same performance and feature level, there are still some disadvantages to using ogl, for example extensions, terrible api, lack of D3DLOCK_NOOVERWRITE (google it, but don’t expect to understand it if you’re not developer ;]) And of course it’s much easier to use dx in production, 'cause it’s widely used in industry for about… hmmmm… 15 years or so?

Doesn’t matter which one is better, it matters whichone is owned by Microsoft.

Sad but true. :[

Here are two interesting reads:
Why you should use OpenGL and not DirectX
DirectX vs. OpenGL revisited
naturally it’s biased (if not without good points) towards OpenGL. But the best are the comments and discussions, so I strongly recommend reading them too.

We are speaking of two APIs here capable of communicating with the graphics hardware. Which one you are going to use really depends on the platform your software will get deployed to. I entertain the thought that a game graphics engine should not be tied to a particular API, but capable of higher level abstraction of the underlying hardware (that way you can implement any API you like in a modular way) the Irrlicht Open-Source Engine is programmed that way.
Considering the different shenanigans (PS3 uses its own API, XBOX with DirectX)you have on the different platforms this is by far the best approach to the problem.
Microsoft has been very busy getting DirectX on the right track (and bribing the right persons into staying loyal to them), I personally hope open standards get adopted by more developers and the new OGL release might hrlp a bit.

WOW! I find more new reasons to hate your guts every day! :stuck_out_tongue:

I have fond memories of OpenGL from when Quake 3 randomly refused to run because some driver file suddenly went missing for no reason and I had to browse through hundreds of magazine demo cd’s to find the one with the latest version of the OpenGL drivers because I didn’t have internet at the time.

Elaborate?

Well, give me d3d-like api and I might switch. And what is the deal with immediate mode? Why couldn’t they just remove it? It’s not like its used anywhere outside of tutorials.

IMO OGL is better and has better performance and is afaik closer to the hardware and doesn’t need a new GFX card for small new features.

Developers need to give us the option to choose which renderer to use, like in the UT games.

Well, in the nineties OpenGL was pretty much established as standard graphics library when Direct3D was still in its diapers. The period leading the new millennium was crucial to the establishing of the API trend.
In the end OpenGL was out maneuvered by DirectX, how many games today come with the OpenGL option? How many are using DirectX Rendering path?
Now how many games are being offered on PS3, WII, XBOX, PC, etc… at the same time but not on MAC or Linux? (somehow they had either to separate their engine from DirectX or it was already programmed as modular engine to begin with. Either way they could make a version for those other platforms but did not, Microsoft anything to do with it? /rhetorical question).
I hope you see where I’m getting at.

Afaik, the PS3 API is based on OpenGL.

totally agree boleth. For a long time openGL has been in a continual state of failure.(not entirely there fault) But with the new standards (have you seen that crazy fucked up Venn diagram of the 40 versions of OpenGL) it seems that they are now going ape shit over there. They now have a version for everything. Web, desktop, mobile phones, rendering, embedded devices. I know it’s very dated now but there is John Carmacks (good read if at least for history) talk on why he chose OpenGL over direct X. It’s a good read and sheds some light onto some of the misinformation over openGL.

@Maxed the Ps3 uses a modified version OpenGL|ES (embed systems). The modifications include calls specific to the nvidia card that gives developers control over shaders.

Or like in Half-Life for that matter. Even Half-Life 2 was supposed to get the opengl option (why was it left out in the end?). Anyway Microsoft did some serious pushing, and the OpenGL team was not really consequent in what it tried to achieve so I can’t really blame it either…

I’ve not much expertise on that particular subject but I’ve seen reports of it being able to use OpenGL ES but the so called “libgcm” api or something being better suited for heavy fancy graphics games.

It wasn’t because m$ had anything to do with it, Mac wasn’t gaming platform (it becomes one tho), and tell me, how many people you know that use linux for gaming? Porting games just for those few wouldn’t pay off, and that’s the main reason.
As for ogl being established library…
Fallout - dx compatible card required
Diablo - dx compatible card required
Legacy of Kain - dx compatible card required
Wanna argue with that? ;]

Well, Diablo does run OpenGL :<

That wasn’t my point, my point was it’s written down on the box. It doesn’t say ‘ogl compatible card required’
To be honest I don’t quite understand all this ogl vs dx argument, developers will use whichever one is more profitable performance/resources/income wise, and its still easier and cheaper to develop windows exclusive games (put consoles and mac aside for a second)

Fallout - 1997
Diablo - 1997
Legacy of Kain - 1995
Win95 era.

First version of DirectX ever shipped on Windows: 1995
Until then OpenGL had the upper hand and surprise just as Windows releases its first rendering api games only swear on this instead of the established API? Call me paranoid but no way Microsoft had nothing to do with it.
And I can take the point about MAC and Linux not having most of the userbase but my point was that since they obviously had to strip off their API to implement another one to make it run on PS3 for instance then why couldn’t they simply take that stripped version and put in there some normal OpenGl API?
Why couldn’t they give the user the choice (on WIndows for instance) between different rendering APIs? Then again isn’t it a bonus to have the greatest userbase possible? (and some linuxers may be more charitable than one might think at first hand)

ogl compatibility is a given anyway. So no point in mentioning it :stuck_out_tongue:
Is it really that much more profitable to develop on Windows? What about all the royalties and such when you want to go commercial? (still, this might not be such a big issue if the developer gets a big slice off Microsoft’s cake for some agreement naturally)
Hell, if a game was Linux exclusive you could just download a distro and install it on it circumventing the costs of an OS. Nowadays those have become just as complicated as Windows’ install routine.

The only memory I have of ever using OpenGL was in Half-Life 1, where it was the graphics renderer (or whatever) option that looked the best.

Because it takes lots of time to develop renderer, be it ogl or dx based, and differences in dx and ogl api’s are so huge nowadays that porting would take longer than making two renderers from scratch. Especially if you want consistent graphic.

What royalties? DX is free for commercial usage, so all you need is legal copy of windows (unless you developed your game on linux).

Still, that didn’t hinder developers to release on all platforms.

OK, I may have spat that one out too fast. But I imagine “some cooperation” is needed for big game studios to release their game with DirectX support, or the Microsoft way is taken willingly into account.
(then you might say cooperation with the khronos group would also most likely cost them the friendly advice and I would agree with you).
In the end it comes down to what you personally feel comfortable with, like you stated in your first reply.
The artist makes the game not the engine, though it will dictate who will get to play the game :stuck_out_tongue:

Now for another question: Have you worked on a project that has gone commercial? Independent? Or something just for fun?
Just my curiosity :slight_smile:

Founded in 2004, Leakfree.org became one of the first online communities dedicated to Valve’s Source engine development. It is more famously known for the formation of Black Mesa: Source under the 'Leakfree Modification Team' handle in September 2004.