IDirect3DTexture Interface

A texture is a rectangular array of colored pixels. (The rectangle does not necessarily have to be square, although the system deals most efficiently with square textures.) You can use textures for texture-mapping faces, in which case their dimensions must be powers of two. If your application uses the RGB color model, you can use 8-, 24-, and 32-bit textures. If you use the monochromatic (or ramp) color model, however, you can use only 8-bit textures.

The IDirect3DTexture interface is an interface to a DirectDrawSurface object. To create an IDirect3DTexture interface, you can call the IDirectDrawSurface2::QueryInterface method and specify IID_IDirect3DTexture. For more information about the relationship between textures in Direct3D and surfaces in DirectDraw, see Direct3D Texture Interface.

The following example demonstrates how to create an IDirect3DTexture interface and then how to load the texture by calling the IDirect3DTexture::GetHandle and IDirect3DTexture::Load methods.

lpDDS->QueryInterface(IID_IDirect3DTexture,

lpD3DTexture); // Address of a DIRECT3DTEXTURE object

lpD3DTexture->GetHandle(

lpD3DDevice, // Address of a DIRECT3DDEVICE object

lphTexture); // Address of a D3DTEXTUREHANDLE

lpD3DTexture->Load(

lpD3DTexture); // Address of a DIRECT3DTEXTURE object

Texture objects reside on the interface list and point both to the next texture in a device's list and back to their associated device or devices. (For more information about this hierarchy, see Object Connectivity.) The texture handle is used in materials and execute buffers, and as a z-buffer for a viewport. You can use the IDirect3DTexture interface to load and unload textures, retrieve handles, and track changes to palettes.

This section describes Direct3D textures and the ways your applications can use them.

·Texture Wrapping

·Texture Filtering and Blending

·Mipmaps

·Transparency and Translucency