Is OpenGL enough or should I also support DirectX?

Started by
29 comments, last by AlanWu 8 years, 9 months ago

I am planning to make a game engine. My target platforms are: android, ios, windows, mac, lunix.

OpenGL should be enough for all of my target platforms but is there anything I need to be aware? (Because I see some game engines support both DirectX and OpenGL while supporting only those platforms I mentioned above)

Thanks!

Advertisement

If you're wanting to target android, ios, mac and linux, you have no ability to use directx on these platforms.

OpenGL will be enough unless you want to learn directx just because it's there, however please note that these different platforms have slightly different forms of OpenGL with different extensions available, which perform differently with differing code. For example the mobile platforms almost exclusively use OpenGL ES rather than the full OpenGL, and within OpenGL there are several versions, depending upon the age of the system you want to target.

Hope this helps!

From a pure portability point of view, you only need OpenGL (and really don't have much of a choice anyway on all named platforms but Windows). There are other reasons to support several backends, though.

It's getting less of an issue these days, but there used to be a good reason to support DirectX anyway under Windows if you already had an OpenGL backend: Driver quality.

Though AMD has stopped shipping shit cards with crap drivers a long time ago (they're not rarely better than nVidia now) and even Intel seems to at least try to produce something halfway sane, up-to-date, and standards-conformant in the mean time. I remember reading Intel even supports the full set of OpenGL 4.3 now (which is kind of a miracle).

If you're wanting to target android, ios, mac and linux, you have no ability to use directx on these platforms.

OpenGL will be enough unless you want to learn directx just because it's there, however please note that these different platforms have slightly different forms of OpenGL with different extensions available, which perform differently with differing code. For example the mobile platforms almost exclusively use OpenGL ES rather than the full OpenGL, and within OpenGL there are several versions, depending upon the age of the system you want to target.

Hope this helps!

Yea it helps. Thank you! :)

Some more questions:

1. Some people say DirectX has less gotchas and headaches than OpenGL on windows. Some also say OpenGL has worse drivers than DirectX. What exactly are they referring to? Will there be any problems or is there anything I need to be aware if I use OpenGL on windows?

2. I hope to support almost every machine, including those very old PC (about 10 years old I guess?) Since I am making a 2D engine, I don't need many advanced features. Is OpenGL ver. 2.0 my best option or should I use a later version?

From a pure portability point of view, you only need OpenGL (and really don't have much of a choice anyway on all named platforms but Windows). There are other reasons to support several backends, though.

It's getting less of an issue these days, but there used to be a good reason to support DirectX anyway under Windows if you already had an OpenGL backend: Driver quality.

Though AMD has stopped shipping shit cards with crap drivers a long time ago (they're not rarely better than nVidia now) and even Intel seems to at least try to produce something halfway sane, up-to-date, and standards-conformant in the mean time. I remember reading Intel even supports the full set of OpenGL 4.3 now (which is kind of a miracle).

Haha I like your stories.

Yea driver quality, that was what I was trying to ask. The point is that I want to support old machines. I wonder if driver can be an issue if I use OpenGL?

Also, I hope to support almost every machine, including those very old PC (about 10 years old I guess?) Since I am making a 2D engine, I don't need many advanced features. Is OpenGL ver. 2.0 my best option or should I use a later version?


1. Some people say DirectX has less gotchas and headaches than OpenGL on windows. Some also say OpenGL has worse drivers than DirectX. What exactly are they referring to? Will there be any problems or is there anything I need to be aware if I use OpenGL on windows?

Yes. You can use DirectX directly on windows, while with OpenGL you have to eigther import the DLL commands yourself (don't do it), or use an external wrapper libary like GLEW, to even be able to do anything with it. Also with DirectX you can directly use your created Windows hWnd, while in OpenGL you must configure your window to have a special HDC and use that. Other than that, using OpenGL is not that much different than using it on any other platform (supposed you even write the application creation code yourself and don't use SFML or what not). In any way this is NO reason to use DirectX on Windows if you already have an OpenGL renderer.


2. I hope to support almost every machine, including those very old PC (about 10 years old I guess?) Since I am making a 2D engine, I don't need many advanced features. Is OpenGL ver. 2.0 my best option or should I use a later version?

Recent OpenGL version have a very bad support rate, I know PCs from < 3 years ago that don't even support 3.4 or whatnot. As for features, if you are making a 2D game, there are not that many of use for you anyways. The wikipedia-page on OpenGL has a full list of it, but I don't see what you could really need. For example, I decided to require at least OpenGL 3.1 as they introduced uniform buffer objects which tied in with my pipeline much more (otherwise I'd have to redesign that), but you shouldn't need that. So OpenGL 2.0 should be just fine.

If you want to support "10+ year old" cards (such as NV30/Geforce FX, or R300/Radeon-9000), you are stuck with OpenGL 2, yes. Though all cards that can support 2.0 can support 2.1 as well (presumed that the driver is up-to-date). This adds pixel buffer object functionality, which may be interesting if you have a lot of sprites to upload for your 2D game.

I would personally never touch anything less than OpenGL 3 again in my life, which is supported by 9 year old graphics cards (such as Geforce 8). The reason not being that the additional hardware functionality is that much useful in comparison, but simply that OpenGL 2.0 is a nightmare to get going with three dozen extensions that you need for some of the most basic things, and no sane guarantees on texture sizes and such. Almost every graphics card, even 15-16 year old ones, can do more than the bare minimum, but given no minimum guarantees you don't know for sure unless you spend considerable work querying (you can't even be sure that you can use a 512-texture).

OpenGL 3 on the other hand, comes with sane (not great, but OK) minimum guarantees and provides almost all functionality that you need, for 90% of everything you will ever be doing in your life (for the other 10% you'll need GL4).

On Windows, do you want to support machines that probably never had a GPU driver update installed, and whose users don't even know how to update drivers? If the answer is yes, you pretty much need to default to DirectX on Windows.

On Windows, do you want to support machines that probably never had a GPU driver update installed, and whose users don't even know how to update drivers? If the answer is yes, you pretty much need to default to DirectX on Windows.

Ugh... those users are a nightmare by themselves. I wouldn't want them as customers. Even if they pay you (chances are they don't, otherwise they'd not have a computer that they pulled out of the trash can), they cannot possibly pay you enough for the support cost they will cause.

On Windows, do you want to support machines that probably never had a GPU driver update installed, and whose users don't even know how to update drivers? If the answer is yes, you pretty much need to default to DirectX on Windows.

Ugh... those users are a nightmare by themselves. I wouldn't want them as customers. Even if they pay you (chances are they don't, otherwise they'd not have a computer that they pulled out of the trash can), they cannot possibly pay you enough for the support cost they will cause.
True. My customers have to know how to follow instructions at least.
It seems OpenGL 2.1 is really bad and can potentially cause a lot of problems?

This topic is closed to new replies.

Advertisement