Title: Introduction%20to%20DirectX%20Implementation
1Introduction to DirectXImplementation
2Installing 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.
3Installing DirectX SDK
- 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.
4Installing SDK Updates
5Setting Up the Development Environment
Include Search Paths Tools-gt Options-gt
Directories tab.
- 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.
6Preparing for Compilation
Linker Search Paths
- 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
7Why use C?
- Language
- Delphi, VB , C , C , Java , C
- Aspects
- Unmanaged against managed
- VB is Interpreter
- Java Virtual machine
- Com supporting (C supports COM better than C
does )
8AppWizard
- 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.
9AppWizard
10AppWizard
11Lets Try it !
12The 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
13Direct3D RM Other Objects
Direct3DRMDevice device // Represents the
visual display destination for the renderer
// to get use CreateDeviceFromClipper()
CreateDeviceFromSurface()
LPDIRECT3DRMWINDEVICE windev device-gtQueryInter
face(IID_IDirect3DRMWinDevice, (void)windev)
// then can use HandlePaint()
camera ??? ?????, ???????????? ?????????????? ?
?????????? ????? ?????????
14Direct3D RM Other Objects
Direct3DRMViewport Defines how the 3-D scene is
rendered into a 2-D window.
d3drm-gtCreateViewport( device, camera, 0,
0, device-gtGetWidth(),
device-gtGetHeight(), viewport )
camera ??? ?????, ???????????? ?????????????? ?
?????????? ????? ?????????
15Direct3D RM Other Objects
Direct3DRMFrame object used by the viewport to
define the viewing position and direction
LPDIRECT3DRMFRAME newframe d3drm-gtCreateFrame(p
arentframe, newframe)
camera ??? ?????, ???????????? ?????????????? ?
?????????? ????? ?????????
16Direct3D RM Other Objects
Direct3DRMMeshBuilder Defines how the 3-D scene
is rendered into a 2-D window.
LPDIRECT3DRMMESHBUILDER meshbuilder
d3drm-gtCreateMeshBuilder(meshbuilder)
camera ??? ?????, ???????????? ?????????????? ?
?????????? ????? ?????????
17Device-Supported Primitive Types
- Microsoft Direct3D devices can create and
manipulate the following types of primitives
18Device-Supported Primitive Types
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.
19Device-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.
20Device-Supported Primitive Types
A triangle strip is a series of connected
triangles
A triangle fan is similar to a triangle strip,
except that all the triangles share one vertex
21DirectX Dependences Tree
22Objects Creation Flow
23DirectX by MFC
24X 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.
25Thank You !