DirectX SDK |
The information in this section pertains only to applications written in C and C++. See Direct3D Immediate Mode Visual Basic Tutorials.
This tutorial explains how to draw a simple 3-D scene using textures. In essence, a Direct3D texture is a bitmap of pixel colors; as a result, any bitmap image can be applied to a Direct3D primitive. Textures are a simple, powerful way to add realism to your 3-D objects without altering their geometry. In this way, textures can be used to enhance a primitive with patterns and illusions of color, roughness, transparency, and smoothness. Specifically, the Using Texture Maps tutorial explains how to create textures from file-based bitmaps and how to render a cube primitive with textures.
Note that texture handles are now obsolete in Direct3D; rather, you create and use textures through interface pointers to the texture surfaces. For more information, see Texture Interfaces and Texture Handles.
In order to add textures to the primitives in your 3-D scenes, complete the following steps:
Direct3D supports an extensive texturing feature set, providing developers with easy access to advanced texturing techniques and strategies. For more information on textures and how they can be used and optimized in Direct3D, see Textures.
Note The code in the Texture application is similar to the code in the Triangle application. This tutorial focuses only on the texturing code unique to the Texture application, and does not cover setting up Direct3D, preparing scene geometry, shutting down, or processing system events. For information on these tasks, see Tutorial 1: Rendering a Single Triangle.
The Texture tutorial draws a cube primitive. For more information on how to draw primitives, see Tutorial 3: Using Alternate Primitive Styles.
The Texture tutorial uses enumeration to enumerate the texture formats. For more information on enumeration techniques and principles, see Tutorial 4: Using Device Enumeration.