directX vs openGL

Could someone explain briefly what the difference between them is, which is better, and which one is going to win as industry standard (or has won?). I sort of understand that they are both higher level languages for drawing polygons etc.
I like to know these things because I hate to think my PC is smarter than me

Direct X is Microsoft’s own API built exclusively for allowing access to graphics, sound, and input routines under Windows. The Direct refers to the fact that you get “Direct” access to video memory (and presumably other system features).

OpenGL developed by SGI covers only graphics and operates on a variety of operating systems.

As DirectX is never going to appear on Unix or Linux systems, its fair to say theres no real competition, although strangely OpenGL ships with all Windows releases… I would say the overwhelming advantage in this case is with OpenGL, as the documentation is free if you care to look around for it.

but as PCs dominate the market, doesn’t this mean that directX will de facto become standard? Most games I see use directx

As mentioned above, DirectX deals with alot of different aspects, whereas OpenGL deals only with graphics. This means that the only appropiate comparison is between Direct3D (the graphics part of DirectX) and OpenGL.

In terms of both performance and functionality the two API’s (Application programming interface) are close to identical. The main difference lies in the interface between hardware and software.

Most Windows games out there support both OpenGL and Direct3D. The truth is that, from a developers point of view, it is very easy to implement one when you have already implemented the other, and so, most software companies do.

As for the future, i don’t se either API dying. DirectX is owned by MS and as a consequence can withstand a lot of competition (it’s been there during a very rough birth). OpenGL has been the de facto standard for many, many years and is still the only option on a lot of platforms and systems.
The only possible threat i can see to OpenGL would be a platform independent version of Direct3D. Knowing both MS and DirectX, this would be a pretty difficult task and very much not like Microsoft. Add the fact there’s little motivation from MS’s part and it all seems very unlikely.

Even the X-Box (Microsofts own gaming system) supports both DirectX and OpenGL.

So is the documentation for DirectX.

The table of contents on the left side of the page points you toward ALL KINDS of technical stuff about DirectX.

You can also download the SDK, in which you get code samples, header files, libraries, utilities, etc. LOTS of stuff here:

OpenGL does have many advantages, but lack of DirectX documentation isn’t one of them. I’ve done both, and they are VERY similar, almost to the point where a lot of stuff is nearly the same code but with different function names.

Is one faster than the other? I’m thinking that if OpenGL is cross-platform, it’s maybe necessarily slower since it can’t take advantage of the quirks of individual platforms, like Java <shudder> ?

Supposing I’m running something like Quake on a Windows box - both DirectX and OpenGL are available to me - which one should I choose?

Not necessarily - most of the high-end video cards have drivers that are optimized for opengl.

The biggest advantage of OpenGL used to be simplicity - it was easier to code than DirectX, DirectX needed alot more initialization and clean up that OGL. However, as I understand it (and I’m no expert), that’s changing.

The up side of DirectX is that incorporates more than just video - theres audio, networking, etc. OpenGL is just video

But, SDL takes care of that some what.

OpenGL is pretty stable, and Microsoft is on the ARB, so I don’t think it or DirectX will go away anytime soon. They seem to be pretty evenly matched

      • I have a ~3-yr old mid-priced videocard, and for most games, it runs smoother and faster on openGL. Neither is particularly “faster” since it’s hardware running the code (that is, your CPU doesn’t do any more work either way) – although one thing I have noticed is that often, they both don’t look the same on-screen: one will be the “correct” (preferrable) brightness, and the other will be considerably darker. Which is which varies.
  • The main advantage that DirectX has is that it adopts faster video hardware features before OpenGL usually does. DirectX gets a new version at least once a year, OpenGL updates about every 2 years or so -or did in the past, anyway.

Not mentioned here yet, so I will mention it: The newest version of OpenGL on the Mac is much faster than the older ones, XOR, Quartz, QD and CG. There are serveral advantages of using it on the Mac over Quartz, not the least of which is speed. Certain Mac Graphics and Presentation Applications that previously relied on Quartz to do their drawing are greatly improved by using OpenGL instead.

So, to answer the OP as far as the Mac is concerned, there is no comparison.

As a former engineer for SGI and the dearly departed 3DFX, as well as working somewhat with Direct X at other places, I’d like to chime in.

First, as others have noted, Direct X is a whole set of APIs, for graphics, sound, etc. The graphics stuff is usually called Direct3D or D3D.

Microsoft’s interaction with OpenGL over the years has been a bit bipolar. First, they love OpenGL. Then, they hate OpenGL. Love. Hate. Love and hate. I believe the current party line is that D3D is for games, and OpenGL is for heavy-duty applications on high-end hardware.

But the fact is that it really doesn’t matter that much. Because, under the covers of both, the people who are actually implementing the important parts of the libraries are the companies who manufacture the hardware. And since they want to sell better than their competition, they try to make both libraries fast on their hardware.

Basically, what they do is try to find which applications are most used, which APIs they use, and which parts of each API are used most. That way, they know which things to spend more time on to get faster. And, in turn, they try to get with the application writers, and try to get them to write their code so that it’s easier for their hardware to draw things quickly. Since the application writers want their product to be faster than their competition, they’ll try to follow their advice, sometimes duplicating entire sections of code, doing things slightly different depending upon which hardware they’re running on.

Also, I’d like to disagree with DougC that D3D implements new hardware features faster than OpenGL. While the actual D3D API has a new version coming out every six months or so, it’s completely controlled by Microsoft, so if a hardware vendor has a new feature that they’d like to be available in D3D, they have to lobby MS very hard to get it in, and if Microsoft doesn’t go for it, too bad.

On the other hand, while OpenGL is owned by SGI, it’s not controlled by them. If a vendor has a really cool feature on their hardware, they can make an OpenGL extension on their own as long as they submit documentation on it, so that another OpenGL licensee could add that extension to their OpenGL implementation. Since the application writers are already duplicating parts of their code for different hardware, adding a useful feature to only some versions isn’t that much more work. If the market really likes the feature, then many vendors are quick to add it to their library, and it usually gets added to the official OpenGL specification quickly thereafter.

It’s an interesting thing, though, that while Microsoft originally created D3D as an OpenGL-killer (even while they were voting members on the OpenGL arbitration board!) it has, in some ways, made OpenGL stronger.

Before D3D, hardware vendors would add extensions that were tailored very exactly to their hardware, making it difficult for others to add that extension onto their system without altering huge swaths of their own hardware. Even worse, they would file patents on some of the underlying technology, so that others couldn’t implement it without violating their patents.

But, when Microsoft shoved D3D down everyone’s throat, they extracted huge concessions from the industry. When a vendor wants Microsoft to add their extension into D3D, they have to license all relevant patents, royalty-free, to Microsoft, and allow Microsoft to license those patents to all D3D licensees, for purposes of implementing D3D on their own hardware.

Before D3D, the OpenGL community was becoming more and more fractured, as folks added functionality to their hardware and made it as difficult as possible for others to add it onto their own hardware.

But with D3D forcing them to allow others to implement those functions, it’s become much less valuable to prevent others to do the same things in OpenGL. All it does is hurt OpenGL, not the other vendors. So folks have become much nicer about licensing; often doing cross-licensing, allowing a vendor access in return for access to some other rights that vendor has.

Depends on the rest of your system and software drivers. I remember about a year ago, my GeForce-2 graphics card ran better with Direct3D… but when one of the Detonator XP drivers came out, the new drivers made most of my games run better (MUCH better) in OpenGL. Nowadays, I still prefer to use OpenGL.

I imagine that you need to take each one on a game-by-game basis.