DirectX 10 - The beginning of the end?
Microsoft released the DirectX December 2005 SDK lately, which contains pre-release DirectX10 information. Looking closer at DirectX10, it might be in my opinion the best reason to switch over to OpenGL now, and support that API on a broader base.
What’s coming?
DirectX 10 (DX10 from here on) is a big step for DX. I won’t give a detailed overview of the changes here, if you’re interested in one, read on GameDev’s DX10 overview. Probably the biggest change in DirectX is that it splits up the core functionality from the rest of the API, by moving low-level logic into the DirectX Graphics Infrastructure (DXGI), something like a graphics “kernel”. The DirectX API (10,11,…) will sit in top of that “kernel”, which should make it easier for Microsoft to update DirectX. Another striking feature is the introduction of the Geometry shader that is basically an extended vertex shader that allows not only manipulating vertices, but also creating new vertices. This is a “must-have” on the track to subdivision surfaces, NURBS and other high-level geometry.
Ok, what’s the deal
First of all, there are some statements from Microsoft that make me wonder. On the one hand, they say that the graphics are all driven by a (according to the PDC 2005 presentations) Kernel-Mode DirectX-Krnl, which is probably the old name for DXGI. This means that the graphics kernel is really part of the kernel, tightly coupled with it. On the other hand, Microsoft announced that the graphics are not part of the kernel any more - they seperated both as freezing of the GUI was one of the most common reasons for lockups.
Even more confusion when you consider the following: According to the PDC 2005 presentation, Windows Vista’s GUI is based completely on DirectX. The whole desktop is rendered using DirectX, i.e. the desktop itself is a DirectX surface. It is also impossible (at least from Microsoft’s side) to support OpenGL in windowed mode as the desktop is locked by DirectX (although IHVs say it would be possible, more on that in a moment). They plan to wrap OpenGL through DirectX, translating OpenGL calls to DirectX. As there is no way - and no interest - in supporting OpenGL extensions, these aren’t wrapped, meaning you can get at most OpenGL 1.4 under Windows Vista. Summing this up, it seems that the GUI and other graphics related stuff really depends on DirectX, and that is all extremly tightly coupled.
But, to come back to the OpenGL thing: Microsoft is very proud that the graphics card is managed by the OS under Vista (yet another statement that makes me wonder, didn’t they say graphics and OS are seperated?), for example, the graphics card’s memory can be virtualized. The current documentation states that resources can be shared between several DirectX applications, for example surfaces. But, this means it should be easily possible for an OpenGL process to write to its own part of the memory and pass that information to the DirectX based desktop compositing engine. Obviously, it’s all not that simple, as both nVidia and 3dlabs have a hard time to get enough information to run OpenGL under Vista without turning off the desktop compositing (see the forums at OpenGL.org).
At the moment, it is only possible to run full-screen apps with full OpenGL support. No chance to see your fancy DCC tools work with the new GUI, same for all your game editors etc. that come with OpenGL windows.
Developers, developers, developers
Another fact about DirectX - this year, they released at least 6 DX9 SDKs this year (February, April, June, August, October, December - at least looking here) - each around 300 Mb large. I hope I didn’t miss one :). What does this mean for you? Well, each odd month, you have to download and install a new SDK just to keep up with your DirectX development. Plus, each SDK comes with higher requirements, the December SDK would love you to have Vista installed to see the DirectX 10 examples. Even using the latest released final Windows version (this should be Windows XP x64 edition) you have no luck with it. And, to be honest, how many people have that version running, let alone a Release Candidate Windows Vista copy with Release Candidate developers tools? Except studios looking to be sponsored by Microsoft, no serious developer is going to do mission-critical work on such a toolset.
This smells of vendor-lockin to me, forcing you not only to use DirectX on Windows, but also force the people to upgrade to Vista (in case you want to use the Geometry shader, for example - no way to use that under Windows XP) and probably also use Managed DirectX soon, as this technology is pushed also. Which means you don’t have any chance to get that running under other OS at all (don’t forget that there are other platform than only PCs where you want 3D graphics, like the PS3). Interesting, when hardware comes out that has the geometry shader, you’ll have only two choices, either use OpenGL (as the geometry shader will be available as an extension there for sure) or force an update to Windows Vista - let’s see which choice people are more willing to take.
So why OpenGL?
OpenGL went a completely different way. There is core functionality that was and is and will be supported always, no matter what extensions are available. It’s C based, so you can access it from virtually any programming language ever invented, there are wrappers for dozens of scripting languages and even .NET (in case you really want to go managed), and many high-level C++ wrappers. But you can basically take your 10 years old copy of GLQuake, add a fancy shader call to it and compile it today and it will still work without further modifications - try this with a DirectX 3 app ;) And, you can develop for OpenGL freely under any OS you want, with any tools you want and without the fear that the stuff you implemented today may be obsolete or deprecated tomorrow.
Plus, you get immediate access to all new hardware features through the OpenGL extensions - no need until a new version of DX is released that supports the fancy new feature you like to take advantage of. And it’s no single company that says what a GFX card has to be able to do, but rather the IHVs themselves. And they surely know best how to use their own hardware.
However, there are also downsides on the OpenGL side: There is no company that is creating an OpenGL SDK, you have to search for your information from various sources. The support varies from IHV to IHV, and sometimes from OS to OS. And sometimes the IHVs are slow when they have to agree on an extension - seems to be getting better though. But considering that it doesn’t force you into a special programming model (Managed Code anyone? Using the Microsoft compiler only? Vista?), and allows you to develop freely, promoting the use of OpenGL is probably the best thing you can do. After all, having choice is what developing is all about, isn’t it?