Ever since I released the AdaTerrainEngine source code I’ve started to get an itch to go back into the OpenGL programming game again.
Something I’ve always been curious about is if Direct3D does have any big advantages over OpenGL but finding a good answer to that question has been hard, probably because there isn’t any. There is no doubt about OpenGL being much more portable and I’ve heard from good sources that it is much easier to get into OpenGL programming than Direct3D. For instance, you need approximately the same amount of lines of C/C++ code to set up an OpenGL window with SDL that you need to write a Hello World! application.
Recently someone told me that Microsoft’s latest DirectX release, version 10, is only available for Vista. I don’t find that weird considering the company’s history of forcing users to upgrade to something they don’t need however what I did enjoy was the fact that Crysis is (somewhat) playable with Wine. This indicates that you can recreate if not all at least the required parts of Direct3D 10 using OpenGL. Microsoft’s excuse for only delivering DirectX 10 to Vista is that it requires the new driver API they invented. I guess that means X11/OpenGL did it right the first time then, hooray.
Peter Kirn argues that OpenGL 2/2.1 offers the same functionality as DirectX 10 without the obvious vendor lock-in. Sometimes you hear people saying that since DirectX is updated more frequent than OpenGL it must be the case that it supports the latest GPU features whereas OpenGL does not. This is very simply not true due to the fact that the base OpenGL API only implements common and accepted functionality available across most GPUs. New features that have just been invented by someone are implemented as OpenGL extensions. These extensions can be implemented at any time and really only requires you to have the latest vendor-supplied driver which will support it. The effect of this is actually that OpenGL can support these new features quicker than DirectX since they do not have to release an entirely new version of their API! One such example is geometry shaders which are implemented by Direct3D 10 but available as GL_EXT_geometry_shader4 in OpenGL 2.1.
The fact is that OpenGL 3.0 is well on its way and it will offer an entirely rethought API which will much better meet todays needs. One of the biggies being that is more object-centric (whereas the current implementation is based on a finite state machine. The API will still be C compatible!
Another big advantage, according to “Some Thoughts on OpenGL 3.0“, is that you no longer need to tediously have to input every single vertex. Instead you can now “stream” a large amount of vertices into OpenGL making it much easier to load large, complicated, models. Another interesting feature is that everything in the API which can be created by shaders will be removed, leading to a cleaner more minimalistic API as opposed to DirectX which is constantly growing.
As desktop adoption of Linux and Mac OS X is constantly growing I believe that OpenGL will regain most of its fame soon. OpenGL 3 needs to be heavily marketed when it is released as I suspect many game developers have been listening to Microsoft for a long time now and they might need some encouragement to take the plunge. Writing portable games does not need to be something difficult as long as people are using the right tools for the job and the gaming industry need to wake up and smell platform diversity explosion that will soon be upon us. The only people I know that still argue against OS X on the desktop are the very same people that have never tried it. As for Linux, it tailors to the more computer literate and in my opinion it should stay that way. Still, the number of computer literate people should be enough to make it an interesting platform for entertainment providers.
nVidia gave a short OpenGL 3 presentation at SIGGRAPH 2007 which is available here.