DirectX and Opengl

Hi:
I understand that directx and opengl are both
3D api. so is there any relationship between opengl and directx?
Opengl device driver is provided by video card
vendor, then who provide the directx device driver? If it is also provided by video card
vendor, then they both should achieve same performance. Then what is the point to compare them as someone did?
Thanks

D3D is a 3D API.
You can compare OpenAL to DirectSound
OpenML to … not sure
plus others

“Opengl device driver is provided by video card”
yes

“vendor, then who provide the D3D device driver? If it is also provided by video card”
Part of it is by video driver and part by MS (d3d8.dll d3d9.dll)

“vendor, then they both should achieve same performance.”

If a program is well programmed, they should be close, but there are no real benchmarks so this is speculation.

There are architectural (design) differences and also implementation differences. For example, it is less efficient to call Direct3D functions then OpenGL functions.
But actually, the performance of both DirectX and OpenGL should be almost the same, that’s true. It is a question of taste (and efficiency) in the end.

Thanks for the reply.
I am just wondering why there exist two 3d api.

If opengl is ok, what is the motivation for
d3d. The bottom line is that they all runs
on the same hardware device. I don’t see
any points for device vendor to provide two sets
of device driver.

If opengl is ok, what is the motivation for
d3d.
Part historical and part Microsoft.

Back in the eldar days, OpenGL was an OK API. But that’s all there was: OpenGL.

Microsoft, in a brilliant idea if not execution (so much of what Microsoft does can be summed up in those words), decided that in order for PC games to logically compete with consoles, they needed a single unified API for hardware access.

See, back in the slightly more eldar days, you had to code to the metal. So you had 10 different versions of audio code, you had 4 different pieces of graphics code. You had to deal with dozens of input drivers for all kinds of devices. And so forth. It was bad.

Microsoft set themselves to the task of dealing with this. So they wrote DirectX: an API designed for the express purpose of abstracting hardware and making developers lives easier. And it worked.

However, there was a hole in the initial revision of DirectX: 3D accelerators. Those were new in those days, and 3DFx was king. But Microsoft felt that it would be best to abstract 3D as well.

This is where the “conflict” starts. Microsoft’s goal is to abstract the hardware for developers. OpenGL’s goal isn’t; it’s job is to provide developers with a single, useful API. That’s why D3D has caps flags and GL doesn’t, and why D3D was bare-bones in terms of features, while GL was covered in them (most of which hardware didn’t even try to accelerate).

The conflict really started because, well, as bad as GL 1.1 was (and it wasn’t that bad), Direct3D v3 (the initial one) was worse. Imagine the most obtuse 3D API, and then square it. It was a horror.

This prompted John Carmack to land firmly in the OpenGL corner, suggesting to all that it be used preferrentially. He wrote GLQuake, and that changed everything. It showed that early GL could be a game-quality API.

As time passed, and D3D stopped being utterly horrific (and only became somewhat ugly), the problem domains really started to overlap. That’s why the “conflict” exists today.

D3D had the advantage of being small and simple for IHV’s to implement, while OpenGL had the advantage of being a bit more future proof. Nowadays, both of these are wrong. GL wasn’t as future-proof as it might have been (though, to be fair, that would have required an unprecidented feat of precience on the part of the ARB). And D3D drivers increased massively in complexity so as to provide a more appropriate, performant abstraction of the hardware.

Or you can just say that Microsoft wants everyone to use their technology and not cross-platform stuff, because it locks them into their platform. I prefer avoiding such “tin-hat” thinking.