Building Virtual Worlds

Moshell - Fall 98

Lecture 15: DirectX and Direct3D

This lecture explains some of the basics of the Microsoft DirectX multimedia support software system, and focuses on an example of the Direct3D Immediate Mode. The source code for this example is located at Microsoft's DirectX site.

DirectX is a software package built into Windows 98 and NT 5.0,  and later versions of Windows 95, and can be added to NT 4.0 and older Win95 installations. The downloads are available from the above DirectX site and are free. "X" in the above is replaced by many different words to name parts of DirectX; such as Direct3D, DirectDraw, etc.

For a basic explanation of DirectX, follow this link.

DirectX's purpose is to provide a uniform programmer's interface for game and other media developers, hiding the differences between graphics, sound and other resources in the actual hardware. This means that DirectX has to do a lot of "busy work" to set up a session, even for something as simple as showing a single triangle.

DirectX Foundation  provides HAL (Hardware Abstraction Layer) to connect applications to specific hardware. If necessary hardware is not there, DirectX also provides HEL (Hardware Emulation Layer) which is software that does the job of the missing hardware. The components of Foundation:

DirectDraw
Direct3D
DirectInput
DirectSound

DirectX Media is the next layer up; it provides behaviors more like VRML's level of integration, such as animation, media streaming, and interactivity. Media includes

DirectShow&trade
DirectAnimation
Direct3D Retained Mode
DirectPlay

DirectX media provides a timing framework to coordinate multimedia.

Components are the highest level of stuff that Microsoft supports. VRML 2.0 is a Component. It makes calls to both DirectX Media and DirectX Foundations, as needed.

Using DirectX. You need four things:

1) The DirectX Software Developer's Kit (SDK) Version 6.0 is the current one, I think.
2) A very good book about DirectX. Microsoft recommends this book.
3) A working example of code (provided with the SDK and also with the book)
4) A mentor who already knows how to use DirectX. (Not me!)

We'll walk through some DirectX code, to give you a flavor of how it all hangs together. The Queries are pretty basic and "pro forma" today.

Query 15.1: What is the relationship between DirectX Foundation and DirectX Media?

Query 15.2: Who is HAL and what the HEL do I care?

Query 15.3: Define the following terms which were encountered while walking through the Direct3d Immediate Mode example:

Callback function
Enumeration of devices
DirectDraw surface
DirectDrawClipper
Background material
World Matrix
View Matrix
Projection Matrix
Execute Buffer

That's all, folks... Onward into Chapter 8 of Vince.

Back to the course index
Back to the course syllabus
Back to the previous lecture
Onward to the next lecture