Once upon a time (okay, it was the late ‘80s/early ‘90s), if you wanted to code a video game, you had to program ‘down to the metal’. This gave you a lot of control and power, but you had to do everything yourself. This included all of the graphics and since that’s most of the heavy lifting, anyone who could come up with a easier way to render shapes and colors on the screen would have the gratitude of programmers everywhere.
Of course, there’s a problem. The advantage of coding down to the metal is that you can take advantage of the features of your video card. The disadvantage is you have to scramble to support new cards or limit your user base and let your code rot as new video cards roll out.
So you have a couple of choices. You can go the DirectX route like Microsoft and just exert your market influence to control the hardware via your PC industry partners. OR you can do what the OpenGL folks did.
The OpenGL Architecture Review Board produced a set of standards for rendering 2D and 3D graphics. OpenGL is designed to be multi-platform and vendor-neutral. Please note that the Board doesn’t supply any actual software but just a set of standards. If you are a video card manufacturer you can download a set of specifications for free and make sure your hardware supports the graphical operations detailed in the OpenGL standards.
DirectX, on the other hand, is controlled by Microsoft and they are the ones that decide what platforms (hardware and software) support it. Well, I say ‘software’. I mean Windows. The DirectX runtime (the part that lets DirectX software work) is built into Windows so it’s basically plug and play. In addition, while OpenGL only specifies methods for rendering graphics, DirectX includes support for audio and gaming controllers. (To be fair, OpenGL was originally developed for engineering and CAD software, not games).
That being said, Microsoft does support OpenGL in Windows along with DirectX so you can, in theory, get the best of both worlds. Of course, I would question not only what percentage of developers take advantage of this, but why they would bother. Granted, if you’re a fan of OpenGL and want to get your game up fast on Windows, then using DirectX for the non-graphical work would keep you from re-inventing the wheel. As I’ve stated before, I Am Not A Programmer(™) and I’d like an answer to this question someday.
I decided to use Xcode simply because of convenience. I used it back in grad school to do some of my (non-Java) assignments and it’s pretty nice, especially considering that it’s free. The current version (5.1.1) is a definite step forward (and yes, I’ve used Visual Studio) and I was able to set things up pretty quickly. I grabbed some sample code from Apple, opened it in the IDE and (absent a few warnings) was able to build and run a nice little animated cube-type thing. It’s written in Objective-C and looks something like this:
It’s pretty cool. The cube rotates slowly around and you can grab it with your mouse and drag it around. I didn’t customize the code too much (added the HELLO WORLD just for grins) so feel free to grab a copy from Apple and play around.