
Game Development with DirectX 9 Contents Contents...................................................................................................................................... 1 Introduction ................................................................................................................................ 5 Prerequisites ............................................................................................................................... 5 Required tools/downloads.......................................................................................................... 5 Conventions................................................................................................................................ 5 D3DX Library ............................................................................................................................ 5 Introduction to DirectX 9 ........................................................................................................... 6 Direct3D..................................................................................................................................... 6 1. Direct3D Initialization........................................................................................................ 6 1.1 Overview ...................................................................................................................... 6 1.1.1 REF Device ........................................................................................................... 7 1.1.2 D3DDEVTYPE..................................................................................................... 7 1.1.3 COM...................................................................................................................... 7 1.2 Preliminaries................................................................................................................. 7 1.2.1 Surfaces ................................................................................................................. 7 1.2.2 Multisampling ....................................................................................................... 8 1.2.3 Pixel Formats......................................................................................................... 9 1.2.4 Memory Pools ....................................................................................................... 9 1.2.5 Swap Chain ......................................................................................................... 10 1.2.6 Depth Buffers ...................................................................................................... 10 1.2.7 Vertex Processing................................................................................................ 10 1.2.8 Device Capabilities ............................................................................................. 10 1.3 Initializing Direct3D .................................................................................................. 11 1.3.1 Acquire an IDirect3D9 interface ......................................................................... 11 1.3.2 Check the device capabilities .............................................................................. 11 1.3.3 Initialize an instance of the D3DPRESENT_PARAMETERS structure ............ 11 1.3.4 Create the IDirect3DDevice9 object ................................................................... 12 1.4 Example Program, D3D Init....................................................................................... 12 1.4.1 Framework .......................................................................................................... 12 1.4.2 d3dUtility.h/cpp................................................................................................... 13 1.4.3 D3D Init Implementation .................................................................................... 14 Display ..................................................................................................................... 14 IDirect3DDevice9:Clear........................................................................................... 15 WndProc................................................................................................................... 15 WinMain................................................................................................................... 15 1.4.4 Compiling with Visual C++ 6.0 .......................................................................... 16 Settings..................................................................................................................... 16 New Project.............................................................................................................. 16 Project Settings......................................................................................................... 17 Adding the source files............................................................................................. 17 Compiling................................................................................................................. 17 1.5 The CreateDevice example ........................................................................................ 18 1.5.1 Differences .......................................................................................................... 18 1.6 Summary .................................................................................................................... 18 2. The Rendering Pipeline.................................................................................................... 19 1 2.1 Model Representation ................................................................................................ 19 2.1.1 Vertex Formats.................................................................................................... 19 2.1.2 Triangles.............................................................................................................. 20 2.1.3 Indices ................................................................................................................. 20 2.2 The Virtual Camera.................................................................................................... 21 2.3 The Rendering pipeline .............................................................................................. 21 2.3.1 Local Space ......................................................................................................... 22 2.3.2 World Space ........................................................................................................ 22 2.3.3 View Space.......................................................................................................... 22 2.3.4 Backface Culling................................................................................................. 23 2.3.5 Clipping............................................................................................................... 24 2.3.6 Projection ............................................................................................................ 25 2.3.7 Viewport Transform............................................................................................ 25 2.3.8 Rasterization........................................................................................................ 26 2.4 Summary .................................................................................................................... 26 3. Drawing............................................................................................................................ 27 3.1 Vertex/Index Buffers.................................................................................................. 27 3.1.1 Creating a Vertex and Index Buffer .................................................................... 27 3.1.2 Accessing a buffer’s memory.............................................................................. 28 3.2 Render States.............................................................................................................. 29 3.3 Drawing preparations ................................................................................................. 29 3.4 Drawing with Vertex/Index Buffers........................................................................... 30 3.4.1 IDirect3DDevice9::DrawPrimitive ..................................................................... 30 3.4.2 IDirect3DDevice9::DrawIndexedPrimitive ........................................................ 30 3.4.3 Begin/End Scene ................................................................................................. 31 3.5 D3DX Geometry Objects........................................................................................... 31 3.6 Examples .................................................................................................................... 32 3.6.1 Triangle ............................................................................................................... 32 3.6.2 Cube .................................................................................................................... 32 3.6.3 Teapot and D3DXCreate..................................................................................... 33 3.7 Summary ...................................................................................................................
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages75 Page
-
File Size-