Introduction to DirectX Implementation
Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the DirectX 9.0 SDK (Software Development Kit) Note that the runtime will be installed when you install the SDK. The DirectX SDK can be obtained at The installation is straightforward; however, there is one important point, make sure that you select the debug option.
The debug option installs both the debug and retail builds of the DirectX DLLs onto your computer, whereas the retail option installs just the retail DLLs. For development, you want the debug DLLs, since these DLLs will output Direct3D- related debug information into the Visual Studio output window when the program is run in debug mode, which is obviously very useful when debugging DirectX applications. Installing DirectX SDK
Installing SDK Updates
Setting Up the Development Environment In VC and 7.0 you will also want to specify the directory paths at which the DirectX header files and library files are located, so VC ++ can find these files. The DirectX header files and library files are located at the paths D:\DXSDK\Include and D:\DXSDK\Lib, respectively. Note The location of the DirectX directory DXSDK on your computer may differ; it depends on the location that you specified during installation. Include Search Paths Tools-> Options-> Directories tab.
Preparing for Compilation In order to build the sample programs, you will need to link the library files d3d9.lib, d3dx9.lib, and winmm.lib into your project. Note that winmm.lib isn't a DirectX library file; it is the Windows multimedia library file, and we use for its timer functions Linker Search Paths
Why use C++? Language: Delphi, VB, C#, C++, Java, C Aspects : 1. Unmanaged against managed 2. VB is Interpreter 3. Java – Virtual machine 4. Com supporting (C++ supports COM better than C does )
AppWizard AppWizard creates a small C++ template application that can integrate the common DirectX components: Direct3D, DirectInput, DirectMusic, DirectSound, DirectPlay. It provides basic functionality that is easy to build on and demonstrates the use of each component.
AppWizard
Let’s Try it !
The Basic Interface All Direct3D interfaces depends on object Direct3DRM (Retained Mode — Direct3D Retained Mode is a high-level 3-D scene graph manager that simplifies the building and animation of 3- D worlds and data ). LPDIRECT3DRM d3drm; // pointer to Direct3DRM Obj Direct3DRMCreate(&d3drm); // create & init obj The main goal of Direct3DRM is to Create other objects
Direct3D RM & Other Objects Direct3DRMDevice device ; // Represents the visual display destination for the renderer LPDIRECT3DRMWINDEVICE windev; device->QueryInterface(IID_IDirect3DRMWinDevice, (void**)&windev); // then can use HandlePaint() // to get use CreateDeviceFromClipper() CreateDeviceFromSurface() camera — это фрейм, определяющий местоположение и ориентацию порта просмотра
Direct3D RM & Other Objects camera — это фрейм, определяющий местоположение и ориентацию порта просмотра Direct3DRMViewport Defines how the 3-D scene is rendered into a 2-D window. d3drm->CreateViewport(device, camera, 0, 0, device->GetWidth(), device->GetHeight(), &viewport );
Direct3D RM & Other Objects camera — это фрейм, определяющий местоположение и ориентацию порта просмотра Direct3DRMFrame object used by the viewport to define the viewing position and direction LPDIRECT3DRMFRAME newframe; d3drm->CreateFrame(parentframe, &newframe);
Direct3D RM & Other Objects camera — это фрейм, определяющий местоположение и ориентацию порта просмотра Direct3DRMMeshBuilder Defines how the 3-D scene is rendered into a 2-D window. LPDIRECT3DRMMESHBUILDER meshbuilder; d3drm->CreateMeshBuilder(&meshbuilder);
Device-Supported Primitive Types Microsoft Direct3D devices can create and manipulate the following types of primitives:
A point list is a collection of vertices that are rendered as isolated points A line list is a list of isolated, straight line segments. The number of vertices in a line list must be an even number greater than or equal to two. Device-Supported Primitive Types
A line strip is a primitive that is composed of connected line segments A triangle list is a list of isolated triangles. A triangle list must have at least three vertices. Device-Supported Primitive Types
A triangle fan is similar to a triangle strip, except that all the triangles share one vertex A triangle strip is a series of connected triangles Device-Supported Primitive Types
DirectX Dependences Tree
Objects Creation Flow
DirectX by MFC
X Files X files provide a template-driven format that enables the storage of meshes, textures, animations, and user-definable objects. Support for animation sets enables you to store predefined paths for playback in real time. X files should be created by CONV3DS utility, or by Direct3D API (Direct3DRMMeshbuilder ) interface.
Thank You !