Does anyone know where I can get some really simple DirectX examples?
I'm looking for something like nehe.gamedev.net, but for DirectX instead of OpenGL.
Thanks.
Does anyone know where I can get some really simple DirectX examples?
I'm looking for something like nehe.gamedev.net, but for DirectX instead of OpenGL.
Thanks.
Which version of DirectX? The main two versions most people use these days are 11 and 12. They are very different from each other. DirectX 12 is the latest, but it is low level compared to 11 and requires the programmer to manage a lot more details. It's kind of the Microsoft answer to Vulkan.
You can find some samples here:
https://github.com/microsoft/DirectX-Graphics-Samples
There is also a book by Frank Luna, but I found it to be just kind of OK. IMO DX12 takes some time to get your head around it no matter how you start.
DX11 is somewhat easier to get started on. I used this website when I started my project some years back:
It now also covers DirectX12 too. If you just want to get something going, 11 might be the way to go. However, if you intend to learn 12 at some point, I'm not sure learning 11 first will help you so much.
If you're interested in DX12, give my tutorial series a try (you can find the link in my signature).
If you're interested in DX11, my advice is to start with Frank Luna's book and complement it with samples from this repo: walbourn/directx-sdk-samples (github.com)
My tutorial series: Tutorial series | P.A. Minerva (paminerva.github.io)
PAM79 said:
If you're interested in DX11, my advice is to start with Frank Luna's book and complement it with samples from this repo: walbourn/directx-sdk-samples (github.com)
One major problem with Frank Luna's DX 11 book is that (from memory) D3DX11 is deprecated and depending on your OS it can be entirely missing, and trying to shoehorn it back in is problematic. As a result, the examples don't work out of the box. I think Luna has a website with the updated code but then you're stuck going back and forth between the book and the site. Probably when it was written it was fine, but IMO it's no longer a good source.
I started with Luna's book myself, but quickly just gave up and found online sources. On occasions I've used it as a reference but that's about it.
Gnollrunner said:
One major problem with Frank Luna's DX 11 book is that (from memory) D3DX11 is deprecated and depending on your OS it can be entirely missing, and trying to shoehorn it back in is problematic. As a result, the examples don't work out of the box. I think Luna has a website with the updated code but then you're stuck going back and forth between the book and the site. Probably when it was written it was fine, but IMO it's no longer a good source.
I started with Luna's book myself, but quickly just gave up and found online sources. On occasions I've used it as a reference but that's about it.
Yes, you're absolutely right.
I also started with Luna's book and updated the code on my own.
However, there are now many repositories on GitHub that host the updated code. If you don't mind alternating between the book and the code, Luna's book remains the best resource to learn DX11, as it covers both the theory (mathematics, computer graphics, and rendering techniques) and practice (DX API with the help of code samples and demos) from scratch.
Anyway, it all comes down to the specific version of DirectX he wants to learn.
My tutorial series: Tutorial series | P.A. Minerva (paminerva.github.io)
Not really a tutorial, but I have a miniseries under the banner of Minimal D3D11: “Minimal D3D11 reference implementation: An uncluttered Direct3D 11 setup & basic rendering primer / API familiarizer. Complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion that should be easy to follow from the code alone. ~215 LOC. No modern C++ / OOP / obscuring cruft”. https://gist.github.com/d7samurai/261c69490cce0620d0bfc93003cd1052 (and more D3D11 based examples here https://gist.github.com/d7samurai/public)