Advertisement

Deciding which graphics API to use

Started by March 20, 2020 08:10 PM
22 comments, last by primarybastard 4 years, 10 months ago

I feel that I need to qualify what I said on the previous page; OpenGL up to about 1.4 was a fantastic API 20 years ago; it's not a fantastic API today.

At what point does D3D11 become easier? That “20 years ago” point in time is significant because there is a dividing line between pre-20-years-ago and post-20-years-ago, and roundabout that time 3 major features appeared which formed that dividing line.

Shaders. Vertex buffers. Render to texture. And in every single one of these, D3D was there first with a cross-vendor solution and offered a simpler, cleaner, more usable and often more performant API. OpenGL on the other hand arrived late after going through rounds of experimental and/or vendor-specific extensions, has been patching these APIs via further extensions ever since, and at the same time the years of accumulated cruft which by then had become overly burdensome was having nothing done with it.

So that's the point at which D3D becomes easier - as soon as you start using these 3 features.

Maybe you think you don't need them for Quake-level rendering, but you'd be surprised. It's far easier to set up certain texture combinations used with this kind of rendering via a line of two of shader code than it is via 20+ lines of glTexEnv/glTexGen calls. Certain animations can be done more efficiently, and much higher quality, via a couple of lines of shader code. You're fighting the API a lot less.

The downside is that there is more of an upfront investment required in planning things out ahead of time, which can steepen the learning curve. You can't just call glBegin and start getting stuff on screen; you need to set up your shader loading, plan creating and updating your buffers, figure out how you'll handle uniforms, etc.

In that case you're generally better off learning from existing code rather than trying to figure it all out for yourself. There are plenty of samples and frameworks available that show how to do all of this, and it's worthwhile tracking them down.

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

primarybastard said:
My graphical requirements are simple, I'm going for a mid-late 90s art style. As of right now I'm only concerned with Windows.

Use WebGL and your game will be available by one click in Window, Mac, Linux, Android and iOS.

primarybastard said:
I'm building my own engine

Start with this books:

I prefer to use TypeScript instead of JavaScript.

Advertisement

@21st Century Moose I think I've settled on DX11 then. Thanks everyone for all the info. Now if anyone knows a good learning resource, feel free to suggest it. All the internet tutorials that I've came across seem a bit messy so far.

@8Observer8 Thanks for the suggestion, but I've already made decent progress on a C++ engine. Input handling with easily rebindable keys, delegate binding, full game loop with entity component system, etc. Just looking to fill out the “render” step with something other than SDL rectangles.

This topic is closed to new replies.

Advertisement