Sunday, January 10, 2010

OpenGL vs DirectX


A post from Wolfire on OpenGL vs DirectX has made a big splash on the usual news sites. My personal opinion can be summed up as: OpenGL (pre 3) - a good learning tool, easy to use. DirectX - good for more advanced things. And OpenGL is just trying to be like DirectX and failing, so why bother with it..


A few things worth noting about the post:
  1. "OpenGL is more powerful than DirectX" - This is just simply wrong. OpenGL does NOT have faster draw calls (they are SLOWER! - the driver has to put together all your glVertex calls, etc.) It does NOT have first access via vendor extensions - this is vaguely true for nVidia, but certainly not for AMD/ATI - infact, I believe OpenGL still doesn't have all the ATI extensions from as far back as 2000. (point sprites anyone?) Other vendors often provide thier own custom API's for additional functionality - OpenGL is rarely at the fore-front and certainly hasn't been for a long time. They also state DirectX has "almost as many features" as OpenGL, and this is completely false. The opposite is true. DirectX has way more features, and a very quick browsing of the OpenGL SDK and DirectX SDK will illustrate that point in no time. Especially if you consider the DirectX utility libraries (mesh compression, ambient occlusion, radiosity - where is that in OpenGL?)
  2. "OpenGL is cross platform" - This is true, one could argue DirectX should be called cross platform too (Xbox), however the key point to make is that OpenGL implementations vary quite a lot so any attempt at using advanced features is likely to end up breaking or looking very different on different platforms. If you are going to develop any kind of serious application, you would use an API-independent graphics engine that would target the native platforms API.
  3. "OpenGL is better for the future of games" - This is absolute nonsense. Most games don't even use OpenGL, and I believe that in the future games will abandon the whole drawing API in favour of their own software engines. Many engines already feature software renders for optimization purposes (typically, occlusion culling). OpenGL and DirectX don't support the concept of raytracing, etc. very well either. I would argue OpenCL/CUDA and custom rendering engines is the future (aka the past, eg: Unreal 1).
The final point made is 'Can OpenGL recover'. If you believe that traditional GPU's are dead (and nVidia believe it: they are focusing on general purpose compute aka GPGPU), then OpenGL will never recover, because the whole need for a graphics API will be gone. I hope we eventually see some kind of Larabee like architecture that maps better to OpenCL than it does to OpenGL and CUDA. Perhaps ID Tech 6, will fit the bill. To quote Carmack: "There's a real chance that the next-generation rendering engine will be a stable, mature technology that lasts in more or less its basic form for a long time" ... "Programmers will move from being engine coders to being technical directors in the Pixar style."

No comments: