Why you should use OpenGL and not DirectX : article

⌘-R in Chief
Posts: 1,261
Joined: 2002.05
Post: #31
Hmm. When I went and looked, what I found suggested the Wii used OpenGL. I guess it's not. Stupid interweb. What the PS3's extensions to OpenGL ES are like, I don't know, but it's still fundamentally GL ES. According to wikipedia it's "OpenGL ES 2.0 compliant except for the use of Cg instead of GLSL."

Of course there are differences between ES and desktop GL, but they're virtually identical compared to D3D vs GL which was my main point.


*feels stupid about Wii mistake* Sad
Quote this message in a reply
Member
Posts: 749
Joined: 2003.01
Post: #32
Duane Wrote:Really, the only platforms that use OpenGL as their only hardware-accelerated platform are Linux/Mac boxes and the iPhone, none of which are particularly significant gaming platforms.


OpenGL works also on Windows... True, you might have some driver issues on some 10% of PCs. But that's a small loss compared to the increased sales you will have by supporting the Mac.

For indies, Mac and iPhone are very significant platforms.

The ideal thing would be having a OpenGL version for Mac and a D3D version for Windows, but if you only have time for one, definitely go with OpenGL.

Or use an engine like Unity that compiles to OpenGL on Mac and D3D on Windows.

As for consoles, I honestly don't have a clue.

©h€ck øut µy stuƒƒ åt ragdollsoft.com
New game in development Rubber Ninjas - Mac Games Downloads
Quote this message in a reply
DoG
Moderator
Posts: 869
Joined: 2003.01
Post: #33
Indie games are a completely different case than AAA titles, though. Indie games tend to be much more word-of-mouth driven, while AAA titles sink a large part of their huge budget into marketing. An indie game might be considered quite successful for selling a few thousand copies, but for the high budget titles you need to sell millions to break even.

The fact that indie games do so well on the Mac, or rather, so badly on Windows, is, and this is the funny part, because the Windows market is too damn large and saturated, and the consumers end up having to look for the needle in the haystack.
Quote this message in a reply
Member
Posts: 142
Joined: 2002.11
Post: #34
DirectX is bad for the whole industry. Unfortunately the reality is it's also a much cleaner API than OpenGL (as of DirectX 10), is more efficient by design, and has the best support on Windows, the market that matters to most game developers. I like OpenGL and open standards, but that's just the truth.
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #35
I know I'm a little late, but I'd like to put in my $0.02.

First, I'll clarify some things about the consoles, since I've worked on all 3 current generation consoles. As mentioned, the Wii doesn't use OpenGL. Some of the functions "feel" like OpenGL, but it requires a lot of manual management of graphics resources, unlike OpenGL. It's also completely fixed function, but you can configure the fixed function pipeline a lot more than OpenGL. On the PS3, OpenGL is an option, however it is a lot slower than using the native graphics API, and is therefore not used by any studios that require any heavy-duty graphics.

There is one thing that all the console APIs, and to some extent DirectX, have that OpenGL doesn't, and that is direct control over the resources. With the PS3 and Wii's APIs, you pretty much have to control the memory resources for stuff like textures, vertex buffers, etc. directly. With DirectX you can specify if a graphics resource only resides in graphics memory all the time or is managed by the API, which means it is in main memory always and can get put in graphics memory when needed.

OpenGL gives you little control over memory resources like that. AFAIK, the only control OpenGL gives you is telling if vertex buffers are dynamic or static, and even that is just a hint. Extra control can give you an edge for resources that you know will be drawn very often, or pre-load resources that you know will be needed shortly. Giving too much control to the driver can also put you more at the mercy to how the driver makes its decisions. For example, OpenGL drivers had to be heavily modified in order to make Doom 3 run acceptably. Right around that time, driver updates made one level of Knights of the Old Republic become unplayable.

Additionally, OpenGL's support for vertex compression is laughable. They just added official support for half floats for vertex buffers in OpenGL 3.0. On top of that, DirectX and the PS3's API support a vertex format that fits 3 component normalized vectors (such as normals, tangents, and bitangents) in 32 bits. The consoles have even more options. Having more compact vertex buffers not only improves memory usage, but it also allows for more effective use of the vertex cache, which speeds up drawing.

Another issue with OpenGL is, from what I can tell, you can't pre-compile shaders. (at least GLSL shaders) If you use a lot of different shaders, having to compile them at run-time can greatly impact load times.

Though many people make the point that with extensions, OpenGL can get features faster, it's not that simple. For one, you are very dependent on when the drivers actually implement those extensions. For example, the ability for extensions doesn't keep Apple from being behind in features. Additionally, as mentioned, they can be a very large pain to use since you have to get the values of enums and load function pointers yourself. Loading one extension may not be enough, either, as sometimes there are multiple extensions that do the same thing that have been used at different periods, some of which are vender-specific. Many extensions eventually get pushed into the core, but that happens at a glacial pace and has been falling farther and farther behind compared to DirectX.

That said, OpenGL is hardly worthless. It's still useful for non-game applications, and is more robust in many areas in DirectX. For example, it's possible to use OpenGL over remote desktop (though I think with DirectX 10 that was fixed), and I don't think you ever have to worry about suddenly losing your device. It's also more multi-platform, in that it works on all 3 major computer platforms, and is more open than DirectX. However, for games, I think the lack of extra control over resources and lack of some key features make it difficult to choose. For games without heavy graphics requirements it's perfectly fine, but with cutting-edge graphics the extra boost you can give yourself with DirectX makes a difference.

In the end, I'd say that it's not just marketing or "because everybody's doing it" that makes people choose DirectX, it truly is superior for making games. While the article is somewhat correct in that it's a positive feedback loop where more people giving support to DirectX makes it better, which causes more people to support it. However, from a game developer's standpoint, you aren't likely going to willingly choose the API that makes you scale back your graphics due to its limitations. And not everybody has the weight of John Carmack to "Ask the ARB to change it" (or Kronos these days), or have special driver patches specifically to get your game to run smoothly.

I would also have to disagree with some conclusions of the article. If you abstract the graphics API in your engine, you should be more willing to use DirectX as your main rendering API, because you can take full advantage of the extra control you have in DirectX, then scale back some things in OpenGL if you port to other platforms. I do want to see OpenGL prosper, but I think that proponents for OpenGL are doing themselves a disservice if they ignore the problem by denying any advantages of DirectX instead of identifying and fixing the problems.
Quote this message in a reply
⌘-R in Chief
Posts: 1,261
Joined: 2002.05
Post: #36
Thanks. Lots of good info.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  No One Cares About Your Game Idea - Article EvolPenguin 2 4,125 Dec 5, 2011 02:05 PM
Last Post: Boaz
  Developer Article: "What have you tried?" kodex 31 15,019 Jul 2, 2009 12:59 PM
Last Post: AlexTheMighty
  Article on Top 100 Independent Games kodex 1 3,060 Jun 27, 2008 06:51 PM
Last Post: Carlos Camacho
  Huge Article on Atari Arcade Games SethWillits 6 4,188 Jun 7, 2008 06:24 PM
Last Post: Duane
  OpenGL 3.0 Article kodex 2 3,005 May 16, 2008 01:06 AM
Last Post: OneSadCookie