Advertisement

Which is easier: OpenGL or Directx

Started by November 15, 2015 05:11 PM
7 comments, last by 21st Century Moose 9 years, 1 month ago

Hello developers,

I'm a C++ programmer that wants to make a game engine, because

he thinks it might be fun and because he thinks that he will

learn alot more about the mechanics behind games and engines from which

he might benefit while making his current game in Unreal Engine 4.

But then I can't decide whether I should use Directx 11 or OpenGL.

I don't really care about performance yet.

I'm just looking for what's easier to learn and use for someone

that hasn't any experience in these topics yet. (For example; whats easier to learn or

which has better/more learning sources).

Cross platform abilities way less for me than the learning curve.

I'm not trying to start a war here, but I just wanted to know

I hope you want to share your own experiences and arguments and thanks.

I think that DirectX is only for the Windows platform. And OpenGL is cross platform.

If you want to learn OpenGL I suggest that you buy a book. And if you want to learn DirectX, buy a book and take a visit to MSDN and check the samples.

It is only taste that separate them.
Advertisement

Direct3D 11 is simpler (in my opinion ofc) becase there are no legacy functions and tutorials to mess with your mind. there 1 or 2 ugly things in that API but otherwise i really like it.
?

I would say DX, also because of the better documentation

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

For a homegrown engine, an interesting option worth considering is basing the rendering layer on BGFX: https://github.com/bkaradzic/bgfx

If it's important to use one of the aforementioned APIs for educational purposes then DirectX 11 certainly has the most learning resources. The API is lower complexity as well.

Alternatively, if you want to try OpenGL, OpenGL ES 2.0 is not a bad place to start. There probably more/better resources for that these days than ever were for the desktop version. Plus it's a much smaller API and useful on every platform, including desktop with some very tiny modifications (or none, if using Angle).

For a homegrown engine, an interesting option worth considering is basing the rendering layer on BGFX: https://github.com/bkaradzic/bgfx

Oooh... Now that is interesting. I've been thinking about building such a compatibility layer for a while, but if someone else has already done the legwork...

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Advertisement

OpenGL or DirectX comes down to the same, only choose one and stick on this one all your learning time.

For DirectX I recommend this book : http://www.amazon.com/Introduction-3D-Game-Programming-DirectX/dp/1936420228

A higher level layer like BGFX wouldn't be a bad choice if you want to make an engine instead of getting stuck on GPU API details.

I used to be a GL fanboi for all the usual reasons, but I'm reformed.
D3D11 is hands down easier, no contest!

GL has retained all previous versions for compatibility - so GL1/GL2/GL3/GL4 are all mixed together, and tutorials are often a mess of all 4. It's very easy to accidentally use features from old versions, or features that are newer than your min-spec.
D3D throws out the old API every new version - so it's easy to know which version of D3D a tutorial/book is aimed at, and impossible to ruin performance by accidentally using 4 different API versions simultaneously.

GL is portable across Windows/Mac/Linux... But it's also implemented differently by each OS+GPU driver - that's a dozen different independent implementations of GL for you to test against! It's very easy to write GL code that works on NVidia, but isn't portable to AMD... so the portability argument is a paradox :(
D3D is also portable to xbox, which frankly is more important than Mac/Linux combined :P

Both are object oriented APIs, but D3D is C++ with COM-lite interfaces, while GL is C with ADT's and opaque handles. GL also uses a shitload of global (thread-local) state, often completely unnecessarily.

D3D shaders are precompiled into bytecode for fast loading and uniform optimization. GL shaders are ASCII source code, which is independently compiled by your driver at runtime, giving long compile times on each run, and differing levels of optimization.

OpenGL is easier to get up and running. The most basic version of it is that you just make a small handful of calls to set some initial state, then some glVertex3f calls, and you've instantly got something on the screen. That's incredibly powerful stuff - fast turnaround and short code with minimal or no up-front planning makes it a great platform for experimentation or when you really need to just get something working in a hurry.

The downside is that this is all talking about OpenGL 1.1 which is nothing at all like how any modern engine works. And I'm not talking about bleeding-edge modern either; OpenGL 1.1 style rendering went out in the Quake 3 timeframe - that's 1999.

So since you mentioned UE4 and you wish to learn the behind-the-scenes mechanics that can assist you with using UE4, you need to know this: OpenGL 1.1 is nothing like how UE4 works. Learning OpenGL 1.1 might get you up and running quickly and easily, but it's going to be absolutely useless for your stated intention.

So it's down to a choice between more modern versions of the two APIs, and in such a case the major difference is that D3D has better quality drivers and better tools and documentation. What all of this means is that (1) if something goes wrong you can be more certain that it's your code rather than some obscure or stupid driver bug, (2) you stand a better chance of being able to more meaningfully find out what that something that went wrong was, and (3) if you need help it's going to be easier to find it. All of this IMO makes D3D easier as a medium-to-longer-term prospect.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

This topic is closed to new replies.

Advertisement