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:

OpenGL 3.0 Birds of a Feather at SIGGRAPH
PDF with slides, via NVIDIA’s Michael Gold

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.

  • costanza

    Insert the boilerplate Microsoft response about how DirectX isn't just a 3D API, it's an entire suite of API's meant to support gameplay, including Direct3D, DirectSound, DirectPlay, DirectShow, DirectInput…

    Except the last three out of those five are in stasis or deprecated. Also, DirectSound is heading for that same status in favor of XAudio 2 in Vista, leaving Direct3D as the only part of DirectX with any staying power to date – unless you count the total API rewrites such as D3D10.

    The Windows market for DirectX based software starts to look like "the XP game market" and "the Vista game market" with these changes in mind, precisely the kind of fragmentation that DirectX was probably meant to avoid.

    In a world where everyone switched to Vista in a few months, this wouldn't be that much of an issue. However, the lack of Direct3D 10 for XP really puts a damper on DirectX based development for newer hardware, since the uptake of newer 3D hardware is a lot faster than the uptake of Vista.

  • http://createdigitalmusic.com Peter Kirn

    Well, right, and the DirectX visuals are really separate from those other APIs. There's nothing stopping you from using DirectInput for input, DirectShow for video capture, but displaying 3D visuals via OpenGL — and many apps do just that.

    There is a replacement being readied for DirectSound, called XAudio2 (based on Xbox's XAudio): http://createdigitalmusic.com/2007/08/06/microsof

    And it does do quite a lot; it wouldn't be entirely fair to compare, say, OpenAL, which is more limited in scope. But even there, it's immensely disappointing that Microsoft didn't ship any sound API in Vista, all while deprecating DirectSound. I'm not at all opposed to proprietary software, but when you're trying to build on a standard, you need to not have Microsoft pulling the rug out from under you. I think that was a great opportunity for OpenAL as far as sound positioning, especially with Microsoft actively promoting OpenAL under Vista.

  • pudman

    <blockquote cite="Peter Kirn">
    The full spec isn’t available yet, and actual OpenGL 3 hardware will be some ways off, but the future looks bright.

    I think it would be more accurate to say that OpengGL 3 drivers will be some ways off. OpenGL 3 is intended to be completely backwards compatible.

    There is the upcoming, so far without an official OpenGL name, "Mount Evans" that, like Direct3D 10, will require minimum hardware features.

    Just wanted to clarify so that developers that read the article don't think "Oh, if OpenGL 3 requires new hardware, how is it different from Direct3d 10, and therefore why should I bother?"

  • moniker

    Just some clarification here. I was actually at the OpenGL 3 presentation at Siggraph so got to absorb the new stuff first hand. OpenGL 3's API will _not_ be backward compatible. They termed current OpenGL has having accumulated layers of cruft over the past 10 years. What _will_ be compatible are the graohics card drivers which once OpenGL 3 drivers are available will support both old school and new school styles. What wasn't clear is if you will have to choose one or the other for your app or be able to mix both. My inclination is to think your app will have to choose one since having both would neagte the efficiencies of the new model.

    In any case, I'm very much looking forward to OGL3 as it will make development and debugging much much easier.

  • http://createdigitalmusic.com Peter Kirn

    Thanks, Moniker. That makes sense. I can't imagine any of the current graphics cards supporting OGL3, though, given the spec isn't even out yet, correct?

    @pudman: Some current graphics cards don't support the full range of OpenGL 2 / OpenGL extensions, so there is a need for both hardware-level and driver-level support. On the other hand, ATI and NVIDIA have both been pretty good in this regard, NVIDIA in particular, at least in my experience.

  • moniker

    right. OGL3 won't be supported until next probably early next year if we're lucky. From what I understand the drivers for OGL3 are already being written but there will be inevitable spec changes until the official doc is published in a month that will force some redesigns. Apparently people got burned last time this happened so they may be more cautious in geting ahead of spec.

  • pudman

    moniker: Yes, you're right. I was intending to mean the hardware would remain compatible.

    <blockquote cite="Peter Kirn">
    Some current graphics cards don’t support the full range of OpenGL 2 / OpenGL extensions, so there is a need for both hardware-level and driver-level support.

    Once again, only "Mount Evans" lists any type of hardware requirement. OpenGL, as an API, has never mandated any extensions.

  • http://www.puppygames.net Cas

    You of course mean JOGL is the other OpenGL binding for Java, right ;) (LWJGL got there first and had 2.0 before JOGL! – I should think it'll have 3.0 first too)

  • http://www.pyjax.net peschler

    Hi Peter. Maybe you should have a closer look at the new X3D browsers and tools like Flux and instantreality. I have used the latter for an immersive installation (including WiiMote control, see http://www.kaskade-projekt.de) and some friends of mine use it for VJing.

    X3D is more high-level than OpenGL and thus easier to use for non-programmers. Actually there is already a binding to use Processing scetches in X3D (as a texture on arbitrary 3D objects), so you can have best of both worlds: http://forum.instantreality.org/index.php?topic=4

  • http://createdigitalmusic.com Peter Kirn

    Hey peschler — I hadn't seen X3D or Processing's X3D stuff! Fantastic; thanks!

    Your work looks really great; I'll have to look through it in more detail…

    Flux looks very nice indeed. I knew I'd find some reason to boot into Windows. :)

    Yeah, before I give anyone that impression, definitely you do NOT want to be at the low level of OpenGL all the time. There are plenty of nice libraries built on top of OpenGL, though. And it's nice to be able to dive down to that level when you need to manipulate shaders, etc.

    I will add, though: Java supports 3D in the browser on Mac, Windows, and Linux, across virtually all browsers, and now works with even JOGL applets (not just Java3D). Silverlight and Flash, by comparison, can only render 2D, and X3D, nice as it is, appears to be limited to browsing in Windows Firefox + IE for now.

  • http://www.pyjax.net peschler

    <blockquote cite="">and X3D, nice as it is, appears to be limited to browsing in Windows Firefox + IE for now.
    Good news. InstantPlayer has full cross-platform support Win, OSX, Linux (several distributions) – thanks to OpenGL: http://instantreality.de/downloads/
    Bad news. Not in the browser. For now. I know there are plans for a cross-platform browser plugin, but it's not there yet.

    Right now the framework is very well suited for interactive installations running in the (non-browser) standalone player interfacing with Arduino, Tracking systems, …

    BTW, you can even put your shader code in the X3D code: http://instantreality.de/documentation/tutorial/s

  • moniker

    wow. I accidentally went to instantreality.com, check it out!

  • http://hippotizer.blogspot.com Josua

    While I agree that OpenGL 2.1 or 3.0 is fully enough for supernice VJ eyecandy effects, transitions and mixes, there is still the question of video decoding. DirectShow (part of DirectX) or its successor WMF (Windows Media Foundation) take advantage of GPU (specific chip, independent of the 3d chip) accelerated decoding and can decode directly into GFX memory, which is key to performance (especially if you want to playback and mix multiple layers in HD). There is no comparable mechanism in the OpenGL world.

  • Sternas Stefanos

    How many new functions for Polygons…?
    How many new functions for Text drawing…?

  • pudman

    <blockquote cite="Josua">
    There is no comparable mechanism in the OpenGL world.

    OpenGL has claimed that they will always do what they do best: Graphics. Thus, even in OpenGL 3, there aren't specialized features for, say, physics or other fanciness that can take advantage of the GPU.

  • http://allanwhite.net Allan W.

    Re: Joshua's comment on video playback on the GPU:

    Does anyone see Apple's forthcoming Core Animation (all the Core [n]'s use the GPU) doing this? While I mostly see Core Animation used as interactive GUI's (cool), I could see using some kind of Quartz Comp./Xcode template for manipulating sources with Core Animation (cooler). Any insights?

  • http://www.webografico.com webon

    Si estais interesados en el diseño grafico y diseño de paginas web,
    os recomiendo echar un vistazo a la web de Webografico estudios (estudio de diseño de barcelona)
    WEBOGRAFICO estudios
    Diseño gráfico y paginas web en Barcelona
    Gracias amigos y a disfrutar http://www.webografico.com

  • Phil

    "Insert the boilerplate Microsoft response about how DirectX isn’t just a 3D API, it’s an entire suite of API’s meant to support gameplay, including Direct3D, DirectSound, DirectPlay, DirectShow, DirectInput…"

    If you kept up with DirectX, you would know that DirectPlay is obsolete and not recommended anymore. DirectSound and DirectInput are being replaced with other technologies that stop third-party APIs from using them easily, known as XACT and XInput. DirectDraw was deprecated, DirectShow is no longer part of DirectX but in the Windows SDK. DirectX is not what it use to be, and hardly anyone seems to look into it more carefully.

  • boessu

    <blockquote cite="Joshua">There is no comparable mechanism in the OpenGL world.

    Maybe there is no other solution on Windows. But I doubt there's nothing comparable on Apple which has OpenGL drivers for this kind of graphics.

    However, watching the paranoia around the copy protection standards for HD in the future (this copy protection chain of the content industry from software through hardware), I don't think this hardware-based renderings into the memory exactly where the programmers want it will be available for that kind of tricks in the future.

  • zeroKnots

    Getting “back to the bare metal” should be a phrase saved for future eras like the 80's were.
    Friggin amazing what crap hardware could do with bare-metal programming.

    What if you could boot-up to drivers with only the bare essentials of the OS.
    Maybe you need the OS to install drivers, but then hardware can be run more directly. Flat memory, maybe no multitasking at all, etc.
    Minimalistic to the max, the most complex program being OpenGL for something like DOS.

    It would be an x-box/pc.

    DOS was ungodly fast compared to 98, 98 2x as fast as XP, now I hear Vista is a real pig.

    Am I the only one with this pipe-dream?

    Of course Microsoft would put a hit out on the person to accomplish this.
    Game programmers would suddenly not need (or want) Windoze OR Linux.

  • liebert

    i am very excited for ogl3, and i want a fully supported gpu for it. is it true that ogl3 will use dx10 supported cards such as the nv8 series?

  • http://www.drm-x.com drm support

    is flash player using opengl, directx or something developed by theirselves?

  • Pingback: dholm.com » Blog Archive » OpenGL 3.0, flip/flop

  • 5ule1m4n

    most not workstation graphic cards got better dx performance than ogl

  • haha

    LOL Java with 3D! thats a way to get performance

  • http://anyeos.wordpress.com Anyeos

    That is true! OpenGL does not need to release a new API to support new hardware features. Because that is a GL extension and a game can take advantage about that just on the fly. You only need to change your graphics card but not need to update OpenGL.
    OpenGL is best in all aspects, some doubt?? Make homework please.
    DirectX10 only have the Graphics API working. Sometimes it is more slow than OpenGL. It have support for a limited platforms: Windows Vista, Windows 7. It works only exclusively in some hardware specifications. The API is well documented but accessing to a low level function is a hard work. There are a lot of promotion about DirectX10 is the best.

    What is the good in DirectX10??? There are some companies that will develop games for DirectX10, that is the only good news.

    Windows 7 interface? See kde 4.3 please: http://www.youtube.com/watch?v=VQHG_30PeX4