Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0...

25
Introduction to DirectX Implementation
  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    266
  • download

    2

Transcript of Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0...

Page 1: Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the.

Introduction to DirectXImplementation

Page 2: Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the.

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 http://msdn.microsoft.com

The installation is straightforward; however, there is one important point, make sure that you select the debug option.

Page 3: Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the.

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

Page 4: Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the.

Installing SDK Updates

Page 5: Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the.

Setting Up the Development Environment

In VC ++ 6.0 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.

Page 6: Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the.

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

Page 7: Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the.

Why use C ?++

Language:

Delphi, VB , C# , C++ , Java , C

Aspects :

1. Unmanaged against managed

2. VB is Interpreter

3. Java – Virtual machine4. Com supporting (C++ supports COM better than C does )

Page 8: Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the.

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.

Page 9: Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the.

AppWizard

Page 10: Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the.

AppWizard

Page 11: Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the.

Let’s Try it!

Page 12: Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the.

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

Page 13: Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the.

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 — это фрейм, определяющий местоположение и ориентацию порта просмотра

Page 14: Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the.

Direct3D RM & Other Objects

camera — это фрейм, определяющий местоположение и ориентацию порта просмотра

Direct3DRMViewportDefines how the 3-D scene is rendered into a 2-D window.

d3drm->CreateViewport( device, camera, 0, 0, device->GetWidth(), device->GetHeight(), &viewport );

Page 15: Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the.

Direct3D RM & Other Objects

camera — это фрейм, определяющий местоположение и ориентацию порта просмотра

Direct3DRMFrame

object used by the viewport to define the viewing position and direction

LPDIRECT3DRMFRAME newframe;

d3drm->CreateFrame(parentframe, &newframe);

Page 16: Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the.

Direct3D RM & Other Objects

camera — это фрейм, определяющий местоположение и ориентацию порта просмотра

Direct3DRMMeshBuilder

Defines how the 3-D scene is rendered into a 2-D window.

LPDIRECT3DRMMESHBUILDER meshbuilder;

d3drm->CreateMeshBuilder(&meshbuilder);

Page 17: Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the.

Device-Supported Primitive Types

Microsoft Direct3D devices can create and manipulate the following types of primitives:

Page 18: Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the.

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

Page 19: Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the.

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

Page 20: Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the.

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

Page 21: 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 Dependences Tree

Page 22: Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the.

Objects Creation Flow

Page 23: 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 by MFC

Page 24: Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the.

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.

Page 25: Introduction to DirectX Implementation. Installing DirectX SDK To write and execute DirectX 9.0 programs, you need both : DirectX 9.0 runtime and the.

Thank You!