Microsoft's DirectX Software Development Kit (SDK) provides an excellent set of application programming interfaces (APIs) that can provide you with various resources needed to develop high-quality, real-time applications. The emergence of DirectX technology will greatly contribute to the development of next-generation multimedia applications and computer games
Overall, there are two main benefits to using DirectX: 1) providing hardware independence for software developers; 2. Provide strategies for hardware development.
1. Provide hardware independence for software developers.
One of the main purposes of Microsoft's development of DirectX is to promote the development of games and multimedia applications on the Windows operating system. Before the emergence of DirectX, the main game development platform was MS-DOS, and game developers racked their brains to make their programs adaptable to various hardware devices. Since the introduction of DirectX, game developers can benefit from the device independence of the Windows platform without losing the feature of direct access to hardware. The main purpose of DirectX is to provide the ability to access hardware as concisely as MS-DOS, to achieve and improve the performance of application software based on the MS-DOS platform, and to remove obstacles for the innovation of personal computer hardware.
On the other hand, Microsoft developed DirectX to provide high-performance, real-time access to hardware for Windows based applications on current or future computer operating systems. DirectX provides a complete and consistent interface between hardware devices and applications to reduce complexity during installation and configuration, and to maximize the utilization of excellent hardware features. By using the interfaces provided by DirectX, software developers can fully utilize the high performance that hardware can bring, without worrying about the complex and ever-changing hardware execution details.
A high-performance Windows based game will benefit from the following technologies:
- Accelerator cards designed specifically to improve graphics processing and quick response capabilities
- Plug and play and other Windows software and hardware
- Communication services built into Windows, including DirectPlay
2. Provide strategies for hardware development
Another important purpose of DirectX is to provide development strategies for hardware vendors, who can receive feedback from high-performance program developers and independent hardware vendors (IHVs). So, in DirectX programmer reference books, technical details of hardware acceleration devices that do not yet exist may sometimes be provided. In many cases, software can simulate these characteristics, while in other cases, software can determine their characteristics based on hardware metrics and ignore performance that hardware does not support.
The characteristics of the display devices that have been and will be implemented include:
- Overlays, due to its support, will make page flipping in the window available in the graphics device interface. Page swapping is a double buffer scheme used to display the entire screen.
- Sprite engines make it easier to overlay sprites (irregular shapes).
- Stretching with interpolation, it can more effectively save display memory because it can extend small images to the entire screen.
- Alpha blending, which can blend colors on the hardware pixel level.
- A 3D accelerator with perspective correct mapping, which allows you to map on 3D surfaces. For example, you can paste brick bitmaps in the corridors of a castle created using 3D software to display perspective effects.
- The bit operations performed for 3D images take into account the Z direction.
- Standard 2 megabytes of display memory, which is the minimum requirement in 3D games.
- Compression standards, which will allow you to store more information in graphics memory. This standard will be executed quite quickly in both software and hardware. It will be used in the texture and includes transparent compression.
The new features of the sound devices to be included include:
- Hardware and its peripherals can provide spatial surround sound effects.
- Audio memory is built-in on the sound card.
- The audio video integrated card can share its memory.
In addition, video playback will benefit from future hardware acceleration devices compatible with DirectX. A feature in future versions of DirectX will be support for hardware accelerated YUV video decoding.
The DirectX SDK provides the following components for Windows based applications.
- DirectDraw: Provides advanced image processing capabilities through direct access to display hardware.
- DirectSound: It provides low latency sound mixing and playback for both software and hardware, hardware acceleration, and the ability to directly access audio devices.
- DirectPlay: It explicitly provides generalized communication capabilities to simplify communication services between your applications.
- Direct3D: It provides real-time, interactive 3D technology for mainstream desktop computers and Internet users.
- DirectInput: It simplifies your application's ability to access mouse, keyboard, and joystick devices.
- DirectSetup: A simple API that provides you with the ability to install DirectX components.
- AutoPlay: It is also a feature of the Win95 operating system, where when you place a CD in the drive, the specified application will automatically execute.
DirectDraw is a member of the DirectX SDK family and the most important component among them. DirectDraw allows programmers to directly manipulate graphics memory, hardware bitmap mapping, as well as hardware overlay and page wrapping techniques. It provides these features while also making it compatible with current Microsoft Windows based applications and device drivers.
DirectDraw is a software interface that is compatible with Windows Graphics Device Interface (GDI) while providing direct access to display devices. DirectDraw is not a high-level graphical programming interface. It provides a device independent approach for game and Windows subsystem software (such as 3D graphics packages and digital video encoding) to gain access to certain advanced features of specific display devices.
DirectDraw is suitable for a wide range of display devices, from simple SVGA displays to advanced hardware implementation devices that provide cropping, scaling, and support for non RGB color formats. Designing such an interface is to enable your application to list the capabilities of low-level hardware and utilize the supported hardware acceleration features. DirectX will simulate features that cannot be implemented in hardware devices.
DirectDraw provides several advantages that were previously only available to software specifically designed for specific display devices.
- Supports dual buffering and page swapping graphics
- Access and control the bitmap mapping of the display card
- Supports 3D z-buffers (z-cache)
- Support hardware assisted coverage in the z-direction.
- Accessing Graphics Scaling Hardware
- Simulate access to standard and enhanced display device memory space
The task of DirectDraw is to provide device dependent access to display memory through a device independent approach. Essentially, DirectDraw manages display memory. Your application only needs to understand general hardware and device related knowledge, such as RGB and YUV color formats and pitch between two raster lines. When you need to use bit conversions or manipulate palette registers, you don't need to worry about the details during the calling process. With DirectDraw, you can easily manipulate display memory and fully utilize the bit conversion and color compression capabilities of different types of display devices, without relying on a specific hardware.
DirectDraw provides a high-performance game graphics engine for computers running on Windows 95 and Windows NT 4.0 or higher.
Undoubtedly, people use DirectDraw to develop various games and multimedia applications because it can bring many powerful feature enhancements to their applications.
- DirectDraw can fully evaluate the capabilities of video hardware, and whenever possible, it will utilize one of its features. For example, if your graphics card supports hardware Blit, DirectDraw will assign the bitmap mapping operation to the graphics card to complete, greatly improving running speed. In addition, when a certain hardware does not support a certain feature, DirectDraw also provides a Hardware Simulation Layer (HEL) to complete this operation.
- The Hardware Abstraction Layer (HAL) of DirectDraw provides a unified interface through which developers can directly operate display and video storage, obtaining maximum performance from the system hardware.
- DirectDraw runs on the Windows 95 operating system and benefits from the 32-bit memory addressing and flat memory model provided by the system. DirectDraw treats videos and system storage as a whole block of space, rather than a collection of fragments. If you have ever used segment offset addressing, you will soon fall in love with this "flat" memory model.
- For full screen applications, DirectDraw makes it extremely easy to perform page swapping operations with multiple backend caches.
- Support clipping of applications in both window and full screen modes.
- Supports 3D z caching.
- Support hardware assisted coverage with z-axis direction.
- Accessible image scaling hardware.
- Can access both standard and enhanced display device memory areas simultaneously.
- Other features include dynamically changing color palettes, exclusive access to hardware, and resolution switching, among others.
Reasonably and effectively utilizing these features of DirectDraw will enable developers to easily write better works than standard based Windows GDI applications, and even MS-DOS applications.
DirectX is a software programming interface based on COM.
The Component Object Model (COM) is the foundation of OLE. COM provides a programming model and binary standard for OLE. COM defines and implements mechanisms for software components such as applications, data objects, controls, and services, collectively referred to as "objects". Each software component object consists of data and functions that access the data, and the collection of functions that access the data of the software component object is called an interface.
From here, it can be seen that the design of COM is in line with C++ Classes are very similar, meaning that a software component object has an internal data structure and a set of external interface functions, allowing access to data through interface functions. Therefore, Microsoft collectively refers to objects executed based on COM as Windows objects. But Windows objects and C++ There are obvious differences in the objects in. Windows objects do not have public data or member functions, so data cannot be directly accessed, which means that data is fully encapsulated.
The provider or server of an object must specify the definition of one or more interfaces, each of which is an interrelated set of functions that execute a property of the object. Each user (or "customer") of an object must have an interface pointer to access the object. When the customer has this pointer, they can use the object without knowing its meaning, even if the customer is running in different processes, machines, operating systems, using different languages developed by different software, or with different versions.
The DirectX SDK interface is created as a fundamental layer in the COM programming hierarchy. Each interface representing a device object, such as IDrectDraw, IDrectSound, and IDrectPlay, is directly derived from the IUnknown OLE interface. The creation of these basic objects is operated on in the dynamic connection library of that object, which is much better than using the CoCreate Instance function specifically designed for creating COM objects in Win32.
Specifically, the DirectX SDK object model provides a primary object for each device. The other device objects are derived from this main object. For example, the DirectDraw object represents the display device. You can use it to create a DirectDrawSurface object representing graphics memory and a palette object representing hardware palettes; Similarly, the DirectSound object represents the sound card, and a DirectSoundbuffer object is created to represent the sound data on the sound card.