Direct3D vs. OpenGL: From a Developer's Perspective
richcoder writes: "GameDev.net has posted an informed article discussing the benefits and drawbacks to using either Direct3D or OpenGL in a game. I've already made the decision to go with OpenGL for my next project, but it looks like Direct3D is gaining ground. Especially in the area of making it simpler to code support for new video card features."
The author seems to be somewhat biased towards OpenGL. This is fine, OpenGL is a good API, but it's starting to show it's age. Here are some points that I don't really agree with:
- He poses the question as to whether low level access and flexibility is worth it (for D3D). He argues that the more simple OpenGL system is sufficient. That is not the case for most game developers. To get the same performance from OGL as you get from D3D, you really need to use extensions from Nvidia or ATI to get to the same level of flexibility that D3D already offers. Things like Nvidia's vertex array range (with NVFence), or ATI's vertex array objects are very, very useful, and a pain to use since developers need to use both to accomplish the same thing.
- OpenGL on Windows does not support multiple monitors (or, I should say multiple video cards). Some drivers do relatively well here, but the WGL layer binding OpenGL to windows is severly crippled, and some dual monitor machines will blue screen just by trying to initialize OpenGL on a single monitor. D3D (since version 5) has no problems with multiple monitors.
- COM is hard to use: probably true, but DX hides as much COM as you possibly can. The result are C++ interfaces that make using DX without directly linking to it much easier. Writing apps that load the underlying rendering libraries (instead of linking with them) will be much easier with D3D than OpenGL. D3D requires 1 function to be queried for (Direct3DCreate), OpenGL requires dozens.
- D3D requires more code: Possibly true, but not for window initialization, more for texture and vertex buffer initialization. Actual setting up of texture state and render state are nearly identical. In any case, the code size difference is negligible.
- OpenGL is cross platform: But support on the Mac SUCKS!! Apple, in their infinite stupidity, decided that extensions that don't work on the Rage 128 wouldn't be supported. So, people buying those $4000 macs with GeForce4 TI cards can be happy with the fact games that are written to use new fangled features like vertex and pixel shaders will never work on the Mac. This may change when DOOM III is released, but I doubt before then. Even support for anti-aliasing would be nice.
I've written low level application rendering code in DX5, DX7, DX8, and OpenGL. There are areas of each that I like more than the others. In the end, I would probably pick DX8 over the rest, although OpenGL and DX7 are probably neck and neck for second.
Dan
OpenGL 2.0 is years away from exposing the hardware to the level DirectX has. The ARB is slow, but hopeful in getting the extensions mess cleaned up.
Microsoft Research has some heavy hitting names in graphics who are paid to do PURE research. This is a pretty formidable resource for Microsoft to leverage into making D3D indispensable to developers. Not every garage game hacker can whip out mesh skinning algorithms.
On the Mac OpenGL side... The Mac OpenGL games have a few titles out now with full screen anti aliasing. One is the Spiderman 1.0.1 Patch just this month for ATI cards.
The challenge with Mac/OpenGL support is developing a good relationship with ATI/Nvidia. Try getting into the community more. Not everyone has the connections Carmack has. The Mac Games Dev list (mac-games-dev@lists.apple.com) is very active.
Mindshare.
If I want to start developing games, I'm going to be looking around to see what I need to learn. DirectX reference material creeps up more often than not. Games that use DirectX are more numerous. Teams need to be built around a common skillset.
It's a chicken-and-egg problem, but it's there nonetheless.
--------
Bleah! Heh heh heh... BLEAH BLEAH!!! Ha ha ha ha...
At one point, the major weakness of D3D is that it has no future largely because it is not cross-platform capable, but when he gets to OpenGL, he states that OpenGL's cross-platform capabilities are irrelevant anyway. So which is it?
I use GCC despite it being a slower compiler. I use XFree86 despite it being a slower windowing system. I use Mozilla despite it being a slower browser. Freedom is more important than speed.
In this case, instead of paying with your pocket book, you pay with your pocket watch. While your "freedom" might be the only quality you care for, that hardly makes it the only one that matters, as you don't buy all the software. I, and many others, are as uncomfortable with your trade-offs as, you must be with ours.
--Jimmy has fancy plans; and pants to match.
please.
http://www.pygame.org/
Please mod this post only if you think others should/n't read this. I have enough ego^H^H^Hkarma. Thanks!
OpenGL 2.0 will doubtfully ever take a major stake of the market, since DirectX/Wintel clusters are marketed as "cheaper." There's a giant rendering farm at LLNL that is all DirectX, mainly because of the lack of availability of Linux/Unix Nvidia stereoscopic rendering drivers. They've been sitting on them for a while, but as you know, Nvidia is in bed w/ micro$oft (Xbox). It sucks when a great os such as Linux can't get decent drivers. Shame on you Nvidia!
My school's CIPIC lab has a immersive workbench, but requires proprietary OpenGL hooks for syncing w/ the shutter glasses.
The biggest trick the devil pulled was letting lawyers become politicians so they can write the laws.