Open GL vs Direct X

SunnyD

Belgian Waffler
Jan 2, 2001
32,674
146
106
www.neftastic.com
OpenGL is a hardware and OS independent 3D API with a nice mechanism for exposing extensions and whatnot. It isn't directly tied in with any particular operating system, and was originally designed with workstation-class 3D graphics in mind. John Carmack is an OpenGL lover.

DirectX, or more appropriately Direct3D is platform dependent on the Windows OS. It is tied directly to a specification published by Microsoft and has a certain level of functionality that must be provided. Is is designed more towards consumer and performance usage, and is tied together with several other features across the DirectX API's.

From a dumbed down point of view - OpenGL is old, carries a lot of baggage from yesteryear even while being able to for the most part match Direct3D's performance. Direct3D is based on a newer programming paradigm, is feature updated (arguably) more frequently, and doesn't rely on any sort of extension mechanism (until very recently) to gain access to newer hardware functions.

Number 1 reason why people use DirectX (as a whole) over OpenGL? Because you already have everything in one API suite under the hood, and it's supported better than OpenGL is on newer Windows OS's.
 

Fox5

Diamond Member
Jan 31, 2005
5,957
7
81
DirectX is many things. It's a whole platform, and operates at a higher level of code (easier to use) than OpenGL. OpenGL is a state-based graphics API without support for a lot of more advanced coding structures and little higher level tools built in. The API design also doesn't support bidirectional communication as well as DirectX, but at the same time is less reliant on its availability as it was basically designed around the cpu as the primary processor, with a dumb pixel drawing device to feed commands into. DirectX was too, but it got updated.

DirectX is the more advanced api, is designed around current hardware, and generally better in many ways.

OpenGL is not bad per se though, it's solid, it works, and it offers DirectX9 level functionality plus a bit more. Its primary use now is on phones, and it suits their hardware better than modern PC graphics cards. But OpenGL is only comparable to one subset of DirectX, Direct3D, and even then Direct3D can operate at a higher level than OpenGL so its easier for developers to use. (there are 3d party kits written around opengl that provide equivalent features to directx)
 

ChAoTiCpInOy

Diamond Member
Jun 24, 2006
6,442
1
81
I thought Open GL 3.2 keeps it ahead of Direct X. What is it about Direct X that makes it better though? Is coding in one easier? Why are games in Direct X? Do they look the same when you use either?
 

Fox5

Diamond Member
Jan 31, 2005
5,957
7
81
I thought Open GL 3.2 keeps it ahead of Direct X. What is it about Direct X that makes it better though? Is coding in one easier? Why are games in Direct X? Do they look the same when you use either?

What about opengl 3.2 in particular keeps it ahead of directx? DirectX has been way ahead for a while.
OpenGL and directX only supported two types of shaders up until recently, pixel and vertex shaders. Pixel shaders are color combiners, vertex shaders can manipulate the positions of triangle vertices. With DirectX10, a new type of shader was added, the geometry shader, that allows for the creation of new geometry, basically useful for subdivision of existing polygons instead of just stretching and shrinking polys.
I don't think OpenGL has this type of shader yet (maybe in vendor extensions).

Coding in DirectX is probably easier since directx is already bundled with higher level coding tools than opengl. There are engines and software packages which probably lessen the gap for opengl though, but it's very low level by itself.
Games are in DirectX because the complete development software package is there, drivers for DirectX were better before OpenGL, OpenGL takes forever to get new versions that support new hardware features (I think the first opengl game with shaders was doom 3 in 2003 or 2004, while directx games had shaders way back in 2000) so OpenGL support drops off with every new version that fails to appear, not all vendors support the same features under OpenGL (proprietary extensions, which directx used to sort of have before dx10), and opengl drivers used to suck for most cards.

There is no visual difference between directx and opengl though. You might be able to make a better looking or faster running directx game using the newer features of DX10, 101., and 11, but since so far no dx10+ game looks noticeably better than the best dx9 can churn out, there probably wouldn't be any visual difference with opengl either.
 

SunnyD

Belgian Waffler
Jan 2, 2001
32,674
146
106
www.neftastic.com
I thought Open GL 3.2 keeps it ahead of Direct X. What is it about Direct X that makes it better though? Is coding in one easier? Why are games in Direct X? Do they look the same when you use either?
As I said - 1-stop shopping across the complete API. OpenGL has been pretty much on parity with Direct3D since 1.2 through extensions. The newer revisions mostly turn a lot of the extensions into standard functions, but still retails the extension mechanism. Ironically, I think D3D10 also introduced a method of getting at extensions as well.

DirectX as a whole gets a little bit of a boost over OpenGL though simply because of who wrote it and how fundamentally it can interact with the OS at a low level.