D3D Texture Mapping

Send Feedback

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


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 CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Samples\CPP\Win32\Directx\d3dm\tutorials\Tut05_textures\``tut05_textures.sln

    Microsoft Visual Studio 2005 launches and loads the solution.

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

  3. Deploy the solution (F5).


The tut05_textures code 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 tu and 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).


Pocket PC SDK: Windows Mobile 5.0 Pocket PC SDK.
Development Environment: Visual Studio 2005.
ActiveSync: Version 4.0.

See Also

Code Samples | D3D Create Device (tut01_createdevice) | D3D Vertices (tut02_vertices) | D3D Matrices (tut03_matrices) | D3D Dynamic Lighting (tut04_lights) | D3D Fixed Point Data (tut06_fixedpoint) | D3D Dynamic | Texture Coordinate Transformation

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.