Microsoft DirectX is a set of application programming interfaces (APIs) for multimedia-related tasks, such as gaming, video playback, and graphics rendering. DirectX provides a standardized way for software developers to access hardware resources like graphics cards, sound cards, and input devices.
Before the release of Windows 95, most games were developed and released for the Microsoft Disk Operating System (DOS) platform, usually using something like DOS4GW or some other 32-bit DOS extender to obtain access to 32-bit protected mode. Windows 95, however, seemed to signal the beginning of the end of the DOS prompt. Game developers began to wonder how they were going to write games optimally that would run under Windows 95 – games typically need to run in full-screen mode, and need to get as close as possible to your hardware.
Table of Contents
- What is DirectX?
Windows 95 seemed to be “getting in the way” of this. DOS had allowed games programmers to program as close to hardware as possible, without going through layers of abstraction and encapsulation. So Microsoft needed to introduce some sort of a model (layer) on top of the Win 95 hardware protection layer. In those days, the extra overhead of a generic API would have made games too slow. DirectX was first introduced in 1995 and has evolved over the years to support the latest hardware and software technologies.
A major update to DirectX API, DirectX 10 ships with and is only available with Windows Vista; previous versions of Windows are not able to run DirectX 10-exclusive applications. Changes for DirectX 10 were extensive, but only Direct3D featured a major overhaul of the API.
The most recent version of DirectX, DirectX 12 Ultimate, was released in 2020 and includes support for ray tracing, variable rate shading, mesh shaders, and other advanced features.
What is DirectX?
DirectX is comprised of application programming interfaces (APIs) that are grouped into two classes:
- The DirectX Foundation layer
- The DirectX Media layer
These APIs enable programs to directly access many of your computer’s hardware devices.
The DirectX Foundation layer automatically determines the hardware capabilities of the computer and then sets the programs’ parameters to match. This allows multimedia applications to run on any Windows-based computer and at the same time ensures that the multimedia applications take full advantage of high-performance hardware.
The DirectX Foundation layer contains a single set of APIs that provide improved access to the advanced features of high-performance hardware, such as 3-D graphics acceleration chips and sound cards. These APIs control low-level functions, including 2-D graphics acceleration; support for input devices such as joysticks, keyboards, and mice; and control of sound mixing and sound output. The low-level functions are supported by the components that make up the DirectX Foundation layer:
The Microsoft DirectDraw API supports extremely fast, direct access to the accelerated hardware capabilities of a computer’s video adapter. It supports standard methods of displaying graphics on all video adapters, and faster, more direct access when using accelerated drivers. DirectDraw provides a device-independent way for programs, such as games and two-dimensional (2-D) graphics packages, and Windows system components, such as digital video codecs, to gain access to the features of specific display devices without requiring any additional information from the user about
the device’s capabilities.
Microsoft Direct3D Immediate Mode
The Microsoft Direct3D Immediate Mode API (Direct3D) provides an interface to the 3-D rendering functions built into most new video cards. Direct3D is a low-level 3-D API that provides a device-independent way for applications to communicate with accelerator hardware efficiently and powerfully.
Direct3D provides application developers with many advanced features, such as:
- Switchable depth buffering (using z-buffers or w-buffers)
- Flat and Gouraud shading
- Multiple lights and light types
- Full material and texture support
- Robust software emulation drivers
- Transformation and clipping
- Hardware independence
- Full hardware acceleration on Windows 2000 (when the appropriate device
drivers are available)
- Built-in support for the specialized CPU instruction sets, including Intel’s
MMX and Pentium III architectures, and the 3DNow! architecture
The Microsoft DirectSound API provides a link between programs and an audio adapter’s sound mixing and playback capabilities. It also enables wave sound capture and playback. DirectSound provides multimedia applications with low-latency mixing, hardware acceleration, and direct access to the sound device. It provides this feature while maintaining compatibility with existing device drivers.
The Microsoft DirectMusic API is the musical component of DirectX. Unlike the DirectSound API, which captures and plays digital sound samples, DirectMusic works with message-based musical data that is converted to digital audio either by your sound card or by its built-in software synthesizer. As well as supporting input in Musical Instrument Digital Interface (MIDI) format, DirectMusic provides application developers the ability to create immersive, dynamic soundtracks that respond to user input.
The Microsoft DirectInput API provides advanced input for games and processes input from joysticks as well as other related devices including the mouse, keyboard, and other game controllers, such as force-feedback game controllers.
The DirectX Media layer works with the DirectX Foundation layer to provide high-level services that support animation, media streaming (transmission and viewing of audio and video as it is downloaded over the Internet), and interactivity. Like the DirectX Foundation layer, the DirectX Media layer is comprised of several integrated components that include:
Microsoft Direct3D Retained Mode
The Microsoft Direct3D Retained Mode API provides higher-level support for advanced, real-time, three-dimensional (3-D) graphics. Direct3D Retained Mode provides built-in support for graphics techniques like hierarchies and animation. Direct3D Retained Mode is built on top of Direct3D Immediate Mode.
The Microsoft DirectAnimation API provides integration and animation for different types of media, such as two-dimensional images, three-dimensional objects, sounds, movies, text, and vector graphics.
The Microsoft DirectPlay API supports game connections over a modem, the Internet, or LAN. DirectPlay simplifies access to communication services and provides a way for games to communicate with each other, independent of the underlying protocol, or online service.
The Microsoft DirectShow API plays multimedia files located in local files or on Internet servers, and captures multimedia streams from devices, such as video capture cards. DirectShow plays video and audio content compressed in various formats, including MPEG, audio-video interleaved (AVI), and WAV.
Microsoft DirectX Transform
The Microsoft DirectX Transform API enables application developers to create, animate, and edit digital images. DirectX Transform works with both two-dimensional (2-D) images and three-dimensional (3-D) images, which can be used to create stand-alone programs or dynamic plug-ins for Web graphics.
DirectX Tool Kit
This is a collection of helper functions and classes that simplifies common tasks in DirectX game development. The DirectX Tool Kit includes a variety of components that can be used to create games and other multimedia applications.
DirectXMath is a library of math functions that is optimized for use with DirectX applications. It provides a set of vector and matrix classes, as well as a variety of math functions, that are designed to work efficiently with modern CPUs and GPUs.
The vector and matrix classes in DirectXMath are designed to be used with hardware acceleration, such as SIMD instructions and vectorized math libraries, to provide high-performance math operations. The library includes support for 2D, 3D, and 4D vectors and matrices, as well as quaternions and colors.