Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
4/8/2010

This code sample is named tut05_textures. It is the second in a series of tutorials on using Direct3D Mobile. It demonstrates how to create 3D texture-mapped objects.

Feature Area

Relevant APIs

Usage

To run the code sample
  1. Navigate to the solution file (*.sln), and double-click it. By default, the solution file is copied to the following folder:

    C:\Program Files\Windows Mobile 6.5.3 DTK\Samples\PocketPC\CPP\win32\directx\d3dm\tutorials\tut05_textures

    Microsoft Visual Studio launches and loads the solution.

  2. Build the solution (Ctrl+Shift+B).

  3. Deploy the solution (F5).

Remarks

The tut05_texturescode sample is an extension of tut04_lights.

3D objects look much more convincing when texture-mapped than they do when lit with just lights and materials. Textures can be thought of as wallpaper that is shrink-wrapped to form to an object.

Textures are typically loaded from image files. Like a Vertex Buffer, textures have Lock() and Unlock() functions to access (read or write) the image data. Textures have width, height, MipLevel, and pixel format. The MipLevel is for "mipmapped" textures — an advanced performance-enhancing feature that uses lower resolutions of the texture for objects in the distance, where detail is less noticeable. The pixel format determines how the colors are stored in a texel. The most common formats are the 16-bit R5G6B5 format (5 bits of red, 6-bits of green and 5 bits of blue) and the 32-bit A8R8G8B8 format (8 bits each of alpha, red, green, and blue).

Textures are associated with geometry through texture coordinates. Each vertex has one or more sets of texture coordinates, which are named tuand tv, and range from 0.0 to 1.0. Texture coordinates can be supplied by the geometry, or they can be automatically generated using Direct3D Mobile texture coordinate generation (an advanced feature).

Development Environments

Pocket PC SDK:Windows Mobile Professional SDK 

Development Environment:Visual Studio 2005 or 2008.

ActiveSync:Version 4.5.

See Also