3D goodness means getting cozy with your local graphics API — and getting ready to nerd out in a big way. OpenGL continues to progress with a major overhaul. It’s a way off, but you’ve still got lots of eye candy with OpenGL 2.1. So … if you’re not Electronic Arts or Bungie, is there really any reason to use DirectX?
With the release of Windows Vista, we’ve been hearing a lot about DirectX, Microsoft’s Windows-only API for accessing graphics hardware. Of course, most of what you’ve been hearing is Windows gaming lovers complaining because they have to upgrade to Vista just to get DirectX 10 — and they take a compatibility and performance hit for many existing games as a result. (The latter isn’t DirectX 10’s fault; it’s a side effect of a new driver and display model in Vista itself, which impacts OpenGL and DX9, as well.) So what’s going on in the OpenGL camp? At SIGGRAPH, OpenGL 3 was announced. The full spec isn’t available yet, and actual OpenGL 3 hardware will be some ways off, but the future looks bright. In a presentation on the new OpenGL, NVIDIA’s Michael Gold pointed to these major hallmarks:
- Getting “back to the bare metal” for performance. This includes cutting back on overhead, streamlining the API, and actually revamping the object model in a way that should boost raw speed.
- Simpler, more efficient application development.
- Simpler driver development.
So that all sounds good. The object model appears to be the major change, with new object meta-classes that make it easier and more efficient to, well, make stuff. Good luck deciphering this at this point (I expect it’ll be easier once the real spec is out), but here’s more on the announcement, with slides:
Us visualists, of course, can leave most of this to developers and hardware makers. What’s nice is that when we do want to make things look slick, we have access to a cross-platform 3D API in tools like Processing/Java, Pure Data (via GEM, etc.), and Max/MSP/Jitter.
As it happens, I’ve been looking at both OpenGL and DirectX solutions while putting together tools and frameworks to do new 3D work. (I’ll admit it, I was briefly … but only temporarily … tempted by the Microsoft tools. More on why I chose to go the other way soon; for now, I don’t want to jinx myself.)
A lot of users understandably wonder about the difference between the two APIs. They might be surprised to discover there’s really little practical difference at this point in terms of what end result you get. OpenGL 2/2.1, not OpenGL 3, is roughly equivalent to DirectX 10 as far as supporting flashy new features. Thanks to extensions to the OpenGL spec, in fact, OpenGL developers often get earlier access to functionality than DirectX 10 developers do, or at least get it on more platforms more quickly.
What I have found is that there’s more friendly documentation for DirectX out there, thanks to the fact that DX is so important to the game market — and thus to amateur game developers, as well. It’s not necessarily that DX is easier than OpenGL, just that if you go to your local bookstore, the OpenGL section is more likely to make you feel like you’ve stumbled into the wrong college math class. (Um, excuse me — where is 17th Century European Literature, please?)
There’s a lively discussion of the OpenGL vs. DirectX debate on the OpenGL boards. Here’s my favorite quote, from forum member Robert Osfield responding to the question of why choose OpenGL over DirectX:
I think one should ask this question the other way around. What possible reason would there be for choosing D3D9/10 over OpenGL 2.x/3.0, given the later is exposes equal or more hardware functionality, and runs on all Windows platforms, and all other major desktop/workstation platforms.
Well said, Robert. Yes, ironically, OpenGL is even more compatible with Windows than Microsoft’s own APIs, thanks to the fact Microsoft decided to use DirectX 10 as a carrot to get people to upgrade to Vista even though it was otherwise a step backward for gamers. (Doh! There’s a nice twist on “cross-platform.”)
That’s not to slam DirectX, mind you. (Okay, maybe a little. A friendly elbow in the stomach rather than a “slam.”) Look, DirectX works very well, and Microsoft has some incredible tools for game development. The point isn’t to compare APIs, on some level: you should be too busy having fun playing with your PC or Xbox 360.
But once you start making your own visuals, you do have a choice. And I mostly find it frustrating that uneducated users assume that, because DirectX and C# are now preferred choices for game development, they must look better or do more when it’s simply not true.
We’ll be watching the new OpenGL closely. And in the meantime, expect some “3D for n00bs by n00bs” entries as I keep working. I’m having lots of fun with JOGL, the Java binding for OpenGL, which already supports OpenGL 2.1 on Mac, Windows (XP and Vista, thank you!) and Linux.