4 ms·
This is sort of a loaded article, since it glances over the benefits of DirectX. (Note: I'm an OpenGL developer, but I worked on implementing D3D10 on top of O
by daeken 17y ago
This is sort of a loaded article, since it glances over the benefits of DirectX. (Note: I'm an OpenGL developer, but I worked on implementing D3D10 on top of OpenGL, and I've worked with DX7+ over the years. I'm not a fan, but leaving these things out is misleading.)
First and foremost, it's wrong to compare OpenGL and DirectX, rather than OpenGL and Direct3D. OpenGL directly competes with a small portion of Direct3D, and requires several libraries (I'm a big fan of SDL, OpenAL, etc myself) to begin to touch the breadth of DX.
Second, with OpenGL you have many vendors producing extensions and implementing them at different times. With Direct3D, you have a single set of features you write for which are guaranteed to be there (in a given version). This means that when you write code for OpenGL, you have to special-case paths for many different available extensions and duplicate many pieces of functionality.
If you want to use shaders, you have to either make your own effects system on top of GLSL/ARB shaders or use something like Cg. The Direct3D effects pipeline saves a lot of time, but of course reduces flexibility.
In the end, the call on OGL vs DX really comes down to these things: How much do you care about cross-platform compatibility? How much time do you have to put into your engine? Do you want complete flexibility w.r.t. your rendering pipeline?
If you're an engine-tech-heavy firm, OpenGL will almost always be the right choice. If you're just making a game, DirectX will almost definitely save you time. Again, I'm not a DX fan, but it has its place, and this sort of article is woefully misleading.
- city41 17y agoOpenGL only competing against a portion of DirectX can be seen as a plus or a minus. I like the fact that OpenGL focuses on one thing and tries to "do one thing and do it well."
- daeken 17y agoAs do I, but it certainly increases the cost of development on a production engine. Personally, I like that; it gives me about as low-level control as possible, which is great, but it's certainly not for everyone.
- snprbob86 17y agoDirectX is an umbrella brand. Direct3D is the equivalent of OpenGL. Most of the Direct3D developers don't even bother to checkout the source code for the other DirectX components.
- freetard 17y agoIs opengl always harder? Aren't there any libs/projects that makes it way easier?
- daeken 17y agoI don't think OpenGL is harder. For many tasks, OGL is just downright simple, especially when using SDL. But if you're producing a production engine, there's a lot of added complexity. If you're interested in OGL development, I strongly suggest NeHe's guides ( http://nehe.gamedev.net/ http://nehe.gamedev.net/ ). Of course, the Red Book is also indispensable.
- moron4hire 17y agoNeHe's guides are pretty well recognized now to be damaging to beginners. The code is sloppy and encourages copy-pasta coding by failing to properly explain the purpose of the code it provides. I really have to recommend against the NeHe guides.
- nitrogen 17y agoIf read in order (at least the first dozen or so), the NeHe guides do explain the purpose of each line of code with reasonable clarity. A decent programmer who is a beginner at OpenGL can use the NeHe guides to get started. I'd agree, though, that a novice programmer should have some additional guidance if using NeHe to learn C programming and OpenGL.
- daeken 17y agoThe NeHe guides get you up and going quickly and provide a base for easy experimentation. That alone makes them hugely useful, I believe. The code is horrendous and there's often a lack of explanation, but it's very easy to take the code and play around with it. They're certainly not the thing to read if you're looking for best practices, but they give you the ability to hit the ground running.
- deleted 17y ago[deleted]
- loup-vaillant 17y ago"If you're just making a game" …for Microsoft's platforms. This article[1] tend to prove that the extra time you spend with OpenGL can be a worthy investment, even if you are "just making a game". (I know you didn't say otherwise, but you sounded like you thought otherwise.) [1]: http://blog.wolfire.com/2008/12/why-you-should-support-mac-os-x-and-linux/ http://blog.wolfire.com/2008/12/why-you-should-support-mac-o...
- daeken 17y agoNo, I certainly agree that cross-platform compatibility is important (the D3D10 implementation I mentioned in my post was for WinXP, OS X, and Linux, and spawned from a reimplementation of Win32 on OS X/Linux), but this has to be weighed against the costs. Going with OpenGL, SDL, OpenAL, etc is certainly not the easy route, even with the huge benefits, and for small dev houses it can easily become overwhelming. If your code needs to be cross platform, then OpenGL (or both, but that again is more expensive) is the only way to go. If cross-platform compatibility would simply be icing on the cake, then you need to weigh the development costs of both approaches.
- nihilocrat 17y agoIf you're just making games, you should just use one of the many free, cross-platform rendering engines (OGRE3D, Irrlicht, etc.) or a comprehensive game-maker (Unity or UDK). Both of these options abstract away OpenGL, Direct3D, shader implementations, extensions, etc. I have wasted a pretty huge amount of my life writing engine code when I don't much care for engine problems and know someone else will be able to write something that performs better and has a good-enough API.