Share via


Creating Texture Maps in Direct3D Mobile (Windows Embedded CE 6.0)

1/6/2010

All texture maps in Microsoft® Direct3D® Mobile are treated as mipmaps. With this approach a regular texture maps is just mipmap with a single level.

You can create a texture map using the IDirect3DMobileDevice::CreateTexture method. This method allows you to specify the height and width of the top level of the mipmap, the number of levels in the map, the format of the memory pool, and the texture map's resource usage flags.

The maximum number of levels in a mipmap are influenced by the height and width of its top level. Direct3D Mobile creates levels such that each succeeding level is half the dimensions of the previous level, down to a minimum of 1 pixel in each direction, and an absolute minimum of 1x1. This implies that if you request a texture with a top level of 16 by 16, and 7 mipmap levels, you will get a map with levels of 16x16, 8x8, 4x4, 2x2, and 1x1. The middleware uses the minimum of the possible number of levels and the given maximum level count.

Setting the number of mipmap levels to 0 signals to the Direct3D Mobile middleware that it should automatically create the correct number of levels based on the top level map sized down to 1x1. This does not cause any filtering, it only creates the levels.

Display drivers may disallow the creation of textures that are not square as well as dimensions that are not a power of two. The driver may also set the largest possible dimensions and the most possible levels in a mipmap. A driver can disable mipmaps altogether by setting the maximum number of levels to 1 via its capability bits.

The Direct3D Mobile middleware will return an IDirect3DMobileTexture interface if the call is successful. Use the IDirect3DMobileTexture::GetSurfaceLevel method to get IDirect3DMobileSurface interfaces to the individual levels of the mipmap. Use the IDirect3DMobileTexture::LockRect method to lock levels of the texture map.

Use the IDirect3DMobileTexture interface to identify the texture map when binding the map to a texture stage.

See Also

Reference

D3DMERR Values

Concepts

Using Direct3D Mobile Resources