Microsoft DirectX Programming: DirectX Components


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.

DirectX came to the rescue, providing a common way for developers to create games that run smoothly on Windows, giving them access to hardware resources and making it easier to work with graphics, sound, and input devices.

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. DirectX 12 is designed to work with Windows operating systems. Specifically, it is compatible with Windows 10 and Windows 11.

Table of Contents

What is DirectX?

DirectX is comprised of application programming interfaces (APIs) that are grouped into two classes:

  1. The DirectX Foundation layer
  2. 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:

Microsoft DirectDraw

The Microsoft DirectDraw API is a powerful tool that enables swift and direct interaction with a computer’s video adapter, tapping into its accelerated hardware capabilities. This API facilitates both conventional methods for displaying graphics across various video adapters and quicker, more direct access when utilizing accelerated drivers.

DirectDraw serves as a device-independent bridge for programs like games, two-dimensional (2-D) graphics software, and Windows system components (such as digital video codecs). It allows them to seamlessly access the distinct features of specific display devices without needing users to provide additional information about the capabilities of their devices.

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:

  1. Switchable depth buffering (using z-buffers or w-buffers)
  2. Flat and Gouraud shading
  3. Multiple lights and light types
  4. Full material and texture support
  5. Robust software emulation drivers
  6. Transformation and clipping
  7. Hardware independence
  8. Full hardware acceleration on Windows 2000 (when the appropriate device
    drivers are available)
  9. Built-in support for the specialized CPU instruction sets, including Intel’s
    MMX and Pentium III architectures, and the 3DNow! architecture

DirectSound API

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.

DirectMusic API

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.

DirectInput API

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:

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.

DirectAnimation API

The Microsoft DirectAnimation API serves as a framework for integrating and animating diverse types of media within applications. It offers support for various forms of media, including two-dimensional images, three-dimensional objects, sounds, movies, text, and vector graphics. Developers can leverage this API to enhance the visual and interactive elements of their applications by incorporating dynamic animations across a wide range of multimedia content.

DirectPlay API

The Microsoft DirectPlay API is designed to facilitate game connections across different networking environments, including modems, the Internet, and local area networks (LAN). This API streamlines the process of accessing communication services, offering a simplified way for games to communicate with each other. Importantly, DirectPlay enables game communication independently of the specific underlying protocol or online service, providing flexibility for developers in creating multiplayer gaming experiences.

DirectShow API

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.

DirectX Transform API

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

The DirectX Tool Kit is a comprehensive assortment of helper functions and classes designed to streamline common tasks encountered in DirectX game development. This toolkit provides developers with a set of components that simplifies the creation of games and other multimedia applications, making it more accessible and efficient to work with DirectX. By offering pre-built functions and classes, the DirectX Tool Kit simplifies the development process, allowing game developers to focus more on the creative aspects of their projects rather than dealing with intricate details.

DirectXMath – Math Functions

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 Central Processing Units (CPUs) and Graphics Processing Units (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.

Categories: Tutorials
Tags: DirectX
M. Saqib: Saqib is Master-level Senior Software Engineer with over 14 years of experience in designing and developing large-scale software and web applications. He has more than eight years experience of leading software development teams. Saqib provides consultancy to develop software systems and web services for Fortune 500 companies. He has hands-on experience in C/C++ Java, JavaScript, PHP and .NET Technologies. Saqib owns and write contents on since 2004.
Related Post