· This is/was my old 'personal website' (~1997 to 2010-ish); my new 'personal website' is at »
As of Oct 2016 I have decided to add some of the old content back again. Note that some of the info on the site is now outdated.
- David Joffe
Game programming with DirectX
[ Home | Chapter 1 | Chapter 2 | Chapter 3 | Chapter 4 | Chapter 5 | Chapter 6 ]

Ye Olde Game Programming with DirectX Tutorial

(was "Game programming with DirectX")

Copyright (C) David Joffe 1997-2001.



Target audience: C/C++ Windows programmers who want to learn to write applications that use Microsoft's confusing API, DirectX. There is some MFC stuff in here, but mostly I am trying to get rid of it. You don't need to know MFC.

Bugs: I have been made aware of a couple of bugs in the code sample. One day far in the future when I find time I will fix them.

1999/12: I have improved the sample ddsamp, and upgraded chapter 3 to be based on this. This demonstrates the PutPixel method described in Chapter 5. I made it with Visual C++ 6, so it includes VC project files, but you don't need VC to use this.

My opinion of DirectX:

Conceptually, the existence of an API like DirectX is a good thing for the industry. Having a single, coherent, standard, continually evolving API that allows programmers to take advantage of the latest hardware relatively transparently is a good thing. In its own way, DirectX has fulfilled its promise of bringing decent games to Windows 95 and family.

However, DirectX is (in my opinion) the most horribly designed API I've ever seen, and I would hate for any newbie game programmers, whose first API might be DirectX, to walk away thinking that it is in any way an example of how a games API should look. DirectX is bulky, poorly documented, unnecessarily overcomplicated, proprietary, and there was never any technical reason for the existence of large portions of it, such as Direct3D (Microsoft ignored the existing industry standard OpenGL simply because it wasn't theirs and it wasn't tied to the Windows platform, not because they thought they could offer a better solution.)

To be fair to Microsoft though, they have slowly made improvements to the DirectX API (the GIGO ("Garbage In, Garbage Out") principle notwithstanding). Getting rid of execute buffers was a good first step, and DirectX 7 shows a number of other cleanups, such as phasing out retained mode, and a cleaner rework of the concepts of viewports and texture objects. They are continually evolving the API, and in the process doing a good job of keeping up with the latest hardware features. OpenGL, on the other hand, appears to be comparatively stagnant. It is a good API, and it will supply you with everything you need to write a 3D game today - but it needs some momentum.

None of the above is meant to change your mind on whether or not you want to learn DirectX. You can't really go wrong learning DirectX. Its not about to go away, and if you want to write games for PC's DirectX is pretty much what you're going to need to learn. There aren't really any alternatives at the moment anyway, and there isn't likely to be for as long as Microsoft rules the roost.

"The Microsoft implementation of OpenGL in the Microsoft Windows NT, Windows 2000, Windows 95, and Windows 98 operating systems is an implementation of the industry-standard OpenGL three-dimensional (3-D) graphics software interface with which programmers create high-quality still and animated 3-D color images" - Microsoft Knowledge Base



These are links to DirectX and graphics related books on Additional user reviews of these books can be found there.

cover Learn Computer Game Programming with DirectX 7.0 (Ian Parberry)
I think this is a good book for programmers who are new to game development and want to 'get into it'. It takes the reader through the entire process of writing a game in fair detail, and covers a lot of ground. I found the writing style fairly pleasant. I think this book would be useful for novices. Note: this book does not cover Direct3D. 3D graphics is a pretty broad topic on its own, and I think in general novice game programmers would be better off working through a book like this one first, then follow it by a book on 3D graphics programming.

cover Computer Graphics: Principles and Practice (Foley/van Dam/Feiner/Hughes)
This book is often referred to as the 'computer graphics bible' by those in the industry, and is generally regarded as a "must-have" book for anyone who is interested seriously in going into computer graphics programming. Although the book is slightly dated, most of the 1000+ pages of content are still relevant and useful, and the book contains a lot of information on 2D and 3D algorithms. This is the one book I do own a copy of. The book is heady reading, its not a "friendly tutorial" - if you are serious about going into graphics programming, you should definitely get this book, otherwise don't. This book is not specifically about game programming but more generally about graphics and animation. It does not cover DirectX, but from it you will be able to learn the principles of APIs such as DirectX.

cover Beginning Direct3D Game Programming (Andre LaMothe)
See user reviews for this book on

Other books:

FAQ (Frequently Asked Questions)

[ Home | Chapter 1 | Chapter 2 | Chapter 3 | Chapter 4 | Chapter 5 | Chapter 6 ]
Follow @d_joffe