Microsoft DirectX 8.0 (C++) |
Before your application creates a rendering device, it can determine if the device supports texturing from compressed texture surfaces by calling the IDirect3D8::CheckDeviceFormat method. This method determines whether a surface format can be used as a texture on a device representing the adapter. To test the adapter, specify any pixel format that uses the DXT1, DXT2, DXT3, DXT4, or DXT5 four character codes (FOURCCs). If CheckDeviceFormat returns D3D_OK, the device can create texture directly from a compressed texture surface that uses that format. If so, you can use compressed texture surfaces directly with Microsoft® Direct3D® by calling the IDirect3DDevice8::SetTexture method. The following code example shows how to determine if the adapter supports the D3DFMT_DXT1 compressed texture format.
BOOL IsCompressedTextureFormatOk( D3DFORMAT TextureFormat, D3DFORMAT AdapterFormat ) { HRESULT hr = pD3D->CheckDeviceFormat( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, AdapterFormat, 0, D3DRTYPE_TEXTURE, D3DFMT_DXT1); return SUCCEEDED( hr ); }
If the device does not 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.