Microsoft DirectX 8.0 (Visual Basic)

Tutorial 6: Using Meshes

Complicated geometry is usually modeled using 3-D modeling software and saved to a file. A example of this is the .x file format. Microsoft® Direct3D® uses meshes to load the objects from these files. Meshes are somewhat involved, but D3DX contains functions to help out. 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 and render a mesh with the following steps.

The path of the Meshes sample project is:

    (SDK Root)\Samples\Multimedia\VBSamples\Direct3D\Tutorials\Tut06_Meshes.

The code in the Meshes sample project is nearly identical to the code in the Lights sample project, except that the Meshes sample project does not create a material or a light. This tutorial focuses only on the code unique to Meshes and does not cover initializing Direct3D, rendering, or shutting down. For information on these tasks, see Tutorial 1: Creating a Device.

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

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

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