Handmade Network»Forums
1 posts
Do you all recommend Direct3D or opengl for beginners?
Edited by tarun_r on Reason: Initial post
Hey all. I'm relatively new to the hand made network community and have a lot of interest in graphics. I've previously tried learning vulkan, but feel like it would be better to try out a higher - level graphics Api to make life a bit easier.
I've noticed that the handmade hero game and Melodist (not sure in development anymore) uses opengl. However, what about direct3D?
are there any projects that use them ? I would love to hear your opinions on both api's as well.
Mārtiņš Možeiko
2562 posts / 2 projects
Do you all recommend Direct3D or opengl for beginners?
Edited by Mārtiņš Možeiko on
If you're aiming to learn modern GPU api on Windows, I suggest starting with Direct3D 11. It does not have old historical baggage, its API is reasonably sane, and most concepts will easily map to newer d3d12 or Vulkan. Until you will write something that is CPU bottlenecked on submitting gpu commands, the d3d11 will have same performance as d3d12 or vulkan. Probably even better performance, because d3d11 is way easier to use.

If you want something simple just to get graphics on screen then OpenGL is fine too, but because of old compatibility stuff it might be very confusing which parts are good to use and which are not.

I have simple C code to get started with D3D11 here: https://gist.github.com/mmozeiko/5e727f845db182d468a34d524508ad5f

70 posts
Professional programmer, working in the video games industry since 2012
Do you all recommend Direct3D or opengl for beginners?

A great resource of usage code for most graphics APIs is the example backends for Dear Imgui: https://github.com/ocornut/imgui/tree/master/examples

It implements just enough of them to display a GUI (quads, sprites and bitmap fonts mainly) and you can check their code to have an idea of which one you'll enjoy the most learning.

As Martins said, D3D11 is probably the best compromise of an API that is widely supported (if you target Windows) and relatively easy to learn while still being modern enough to give you an idea of how a modern GPU works.
183 posts / 1 project
Do you all recommend Direct3D or opengl for beginners?
Both APIs have too many bugs and platform limitations for me, so I moved to software rendering. Easier to debug and profile. More memory safety and freedom to abstract functionality the way you want. If using the GPU again, I would use an API abstraction that includes Vulkan, Direct3D and Metal (relatively stable with pre-compiled shaders to reduce driver complexity) to avoid being tied down to a specific system while still getting control over depth buffers and such.

Direct3D 11
Would be kind of nice if it was portable, but Windows does not have a promising future after they started to bully users with illegal forced updates and spyware. If you make a beginner mistake in Direct3D, you might crash your graphics drivers and have the computer reboot with damage to the file system. You need to know how memory padding works differently between CPU and GPU in order to send data to shaders. If you make anything advanced like physics calculations in Direct3D 11, the shader optimization will often fail and return black pixels.

A terrible old mess about to be phased out. Lots of fixed function legacy. New features need third party extension wranglers to avoid an endless pile of boilerplate code. During my years as a firmware developer, I have never seen a single OpenGL driver that followed the standard, not the biggest GPU vendors, not even the reference implementations. There are absolutely no features in OpenGL that can be relied on to function properly because most interpretations are open for debate between competitors. You will very soon feel too limited by OpenGL.