# Doing legacy DirectX Coding on Windows 10

I decided to study couple of old computer graphics books like Andre LaMothe's Tricks of 3D Game Programming Gurus. I feel like this book is full of great general computer graphics knowledge and I want this to be an exploration.

The problem is, since the book is old, it uses a very old DirectX API. It is DirectX 7 I guess. I want to be able to code the presented ideas myself and I have a Windows 10 machine. And I have couple of more old books which uses old APIs like DirectX 7 and 8. The question is;

What are my options if I want to code the examples in these books? Is there a way to write DirectX 7,8 and 9 code in Windows 10? I checked the articles "Where is the DirectX SDK?" from MSDN but they are mainly about how to move from D3D9 to new APIs. I want to code in those APIs for the sake of doing the exercises in the book, not move from those APIs. I think this should be possible because I am playing games from these eras in my computer today. If my computer is able to run them, there should be a way for me to write them as well.

If this is not possible or is very hard, how hard it would be for me to convert and try these ideas on modern OpenGL while I read the books?

In the case that I am completely lost, do you think I can still learn the computer graphics ideas presented in the books by reading the code and making sense of it, even if I don't code them myself?

NOTE: I have fundamental knowledge of computer graphics and modern OpenGL. It is not like I am choosing these books to begin my CG exploration. There are probably better, modern books for those and I read couple of them. The reason I want to read these books is because I like old books :) and I want to explore old wisdom lay in these.

• Because most techniques in computer graphic is independent from API, yes, you can convert them to OpenGl if you have a basic understanding of DirectX – Bálint Apr 9 '16 at 22:37
• I know I can convert them if I have sufficent time but does this hinder my learning experience from the book? Is it better if I just code the examples in these old APIs for learning purposes? If so, is it possible to use those old APIs in new Windows 10? – meguli Apr 10 '16 at 0:11
• DirectX is fully backwards compatible, you won't have problem with that. – Bálint Apr 10 '16 at 0:15
• @Bálint but how to set up old DirectX SDK? I saw that newer versions are included with my Windows SDK but what about setting up something like DirectX 8? How can I make it work with my Visual Studio or other editör of my choice? – meguli Apr 11 '16 at 10:54
• @megull I thinkbyou can download it. You need to download the newer SDKs if you dob't have wib 8 too. – Bálint Apr 11 '16 at 10:56

You can continue to use the legacy DirectX SDK for Direct3D 9 on Windows 10, but there are a number of caveats:

First, there is no Direct3D 9 Debug support on Windows 8.0, Windows 8.1, or Windows 10. That means no helpful diagnostic information in the debug window. The last OS to support Direct3D 9 debugging was Windows 7.

Second, if you are using VS 2012, VS 2013, or VS 2015 then you have to 'mix' the old legacy DirectX SDK with the newer Windows 8.x SDK carefully. The basic instructions for doing this are on MSDN and essentially involve swapping the include order for headers and libs: the Windows 8.1 SDK headers first, then the legacy DirectX SDK headers.

The old DXERR.LIB is simply not compatible with VS 2015 at all. You can use this replacement instead.

It's also useful to read The Zombie DirectX SDK. This is a more nuanced exploration of which parts of the legacy DirectX SDK still have legitimate uses and which should not be used.

Actually installing the legacy DirectX SDK is also a challenge as it has some known issues.

This gets you 80% there and works for Direct3D 9. It's a bit more complicated if you want to use XAudio 1.3 or XAudio 2.7, but If you have Windows 10 you can just use the built-in XAudio 1.4 and XAudio 2.8 anyhow. See XINPUT and Windows 8 and XAudio2 and Windows 8 for more information.

There's really no good way to get an old enough DirectX SDK to contain D3DX8 to work with modern compilers, so Direct3D 9 is already pushing it. The DirectDraw7, Direct3D 7, Direct3D 8.x, and DirectSound APIs are supported for appcompat purposes by the OS, but YMMV. For more on which APIs are available where, see DirectX SDKs of a certain age.

This is a whole lot of pain to sign up for just to use outdated books and legacy APIs that have much better modern replacements. You should probably instead focus on DirectX 11, take a look at DirectX Tool Kit, and look for newer books. Once you actually understand how to code against DirectX 11, then you should have little problem in adapting the older books where the content is still applicable.