Microsoft DirectX 8.1 (Visual Basic)

Tutorial 5: Using Texture Maps

While lights and materials add a great deal of realism to a scene, nothing adds more realism than adding textures to surfaces. Textures can be thought of as wallpaper that is shrink-wrapped onto a surface. You could put a wood texture on a cube to make it look like the cube is actually made of wood. The Texture sample project adds a banana peel texture to the cylinder created in the Lights sample. This tutorial covers how to load textures, set up vertices, and display objects with texture.

This tutorial implements textures with the following steps:

Note  The path of the Textures sample project is:

    (SDK root)\Samples\Multimedia\VBSamples\Direct3D\Tutorials\Tut05_Textures.

The code in the Texture sample project is nearly identical to the code in the Lights sample project, except that the Texture sample project does not create a material or a light. This tutorial focuses only on the code unique to textures and does not cover initializing Microsoft® 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.