Microsoft DirectX 8.1 (Visual Basic) |
The mesh is loaded and ready to be rendered. The mesh is divided into a subsets for each material that was loaded for the mesh. To render each subset, the mesh is rendered in a loop. The first step in the loop is to set the material for the subset, as shown in the following code fragment.
g_D3DDevice.SetMaterial g_MeshMaterials(i)
The second step in the loop is to set the texture for the subset, as shown in the following code fragment.
g_D3DDevice.SetTexture 0, g_MeshTextures(i)
After setting the material and texture, the subset is drawn with the D3DXBaseMesh.DrawSubset method, as shown in the following code fragment.
g_Mesh.DrawSubset i
The DrawSubset method takes a Long value that specifies which subset of the mesh to draw. This sample uses the value that is incremented each time the loop runs.
This loop will run until each subset in the mesh has been rendered.
This tutorial has shown you how to load and render meshes. This is the last tutorial in this section. To find out how a typical Microsoft® Direct3D® application is written in Microsoft Visual Basic®, check the DirectX Graphics Visual Basic Samples.