Microsoft DirectX 8.1 (Visual Basic)

Tutorial 4: Creating and Using Lights

Microsoft® Direct3D® lights add more realism to 3-D objects. When used, each geometric object in the scene will be lit based on the location and type of lights that are used. The Lights sample project introduces the topics of lights and materials.

This tutorial takes the following step to create and use materials and lights.

Note  The path of the Lights sample project is:

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

The code in the Lights sample project is nearly identical to the code in the Matrices sample project. This tutorial focuses only on the code unique to lights 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.