Texture Compression

DirectDraw provides services to compress surfaces that will be used for texturing 3-D models. For information on creating and manipulating the data in a compressed texture surface, see Compressed Texture Surfaces in the DirectDraw documentation.

Once your application creates a rendering device, it can determine if the device supports texturing from compressed texture surfaces by calling the IDirect3DDevice3::EnumTextureFormats method. The method calls the D3DEnumPixelFormatsCallback callback function that you provide for each pixel format that the device supports for texture maps. If any of the enumerated pixel formats use the DXT1, DXT2, DXT3, DXT4, or DXT5 four character codes (FOURCCs), the device can texture directly from a compressed texture surface that uses that format. If so, you can use compressed texture surfaces directly with Direct3D by calling the IDirect3DDevice3::SetTexture method. If the device doesn't support texturing from compressed texture surfaces, you can still store texture data in a compressed format surface, but you must convert any compressed textures to a supported format before they can be used for texturing. The DirectDraw blit methods, IDirectDrawSurface4::Blt and IDirectDrawSurface4::BltFast, automatically perform conversion of compressed formats to standard RGBA formats. To minimize loss of information, try to pick a destination pixel format that closely matches the compressed format. For instance, ARGB:1555 would be a good destination format for DXT1, but ARGB:4444 would be a better choice for DXT3 since DXT3 contains four bits of alpha information.