Microsoft DirectX 9.0

Tutorial 6: Using Meshes

Complicated geometry is usually modeled using 3-D modeling software and saved to a file. An example of this is the .x file format. Microsoft?Direct3D?uses meshes to load the objects from these files. Meshes are somewhat complicated, but Direct3D extensions (D3DX) contains functions that make using meshes easier. The Meshes sample project introduces the topic of meshes and shows how to load, render, and unload a mesh.

This tutorial shows how to load, render, and unload a mesh using the following steps.


Note  The path of the Meshes sample project is:

(SDK Root)\Samples\C++\Direct3D\Tutorials\Tut06_Meshes.

The sample code in the Meshes project is nearly identical to the sample code in the Lights project, except that the code in the Meshes project does not create a material or a light. The Using Meshes tutorial focuses only on the code unique to meshes and does not cover setting up Direct3D, handling Microsoft Windows?messages, rendering, or shutting down. For information about these tasks, see Tutorial 1: Creating a Device.

This tutorial uses custom vertices and a vertex buffer to display geometry. For more information about selecting a custom vertex type and implementing a vertex buffer, see Tutorial 2: Rendering Vertices.

This tutorial makes use of matrices to transform geometry. For more information about matrices and transformations, see Tutorial 3: Using Matrices.

This tutorial uses textures to cover the surface of the mesh. For more information about loading and using textures, see Tutorial 5: Using Texture Maps.

© 2002 Microsoft Corporation. All rights reserved.