# Direct3D Textures

# Direct3D Textures

This extensions contains functions for loading and saving Direct3D textures using Imaging and for converting images to textures and vice versa. Currently supported Direct3D version is 9.0. You need Direct3D headers for Object Pascal to be able to compile this extension. They can be found at http://www.clootie.ru. Extension does not require D3DX library so if you use it only for loading or saving textures you can replace it by Imaging and remove dependency on 2+ MiB dll file. It is implemented in ImagingDirect3D9.pas unit located in (ImagingRoot)\Source\Extensions directory. To use it simply add this unit to uses list of your program. Currently only 2D textures are supported, DXTC/S3TC and 3Dc compressed, and floating point textures are created if supported by hardware.
Here is the table with Direct3D functions currently available. There is also Imaging Direct3D demo you can look at for inspiration Object Pascal Direct3D Demo.

## Imaging Direct3D extension functions

Loading Functions
LoadD3DTextureFromFile
LoadD3DTextureFromStream
LoadD3DTextureFromMemory
Saving Functions
SaveD3DTextureToFile
SaveD3DTextureToStream
SaveD3DTextureToMemory
Conversion Functions
CreateD3DTextureFromImage
CreateD3DTextureFromMultiImage
CreateD3DSurfaceFromImage
CreateImageFromD3DTexture
CreateMultiImageFromD3DTexture
CreateImageFromD3DSurface
Other Functions
GetDeviceTextureCaps
IsD3DFormatSupported
ImageFormatToD3DFormat
D3DFormatToImageFormat

LoadD3DTextureFromFile and similar functions use these default values: All mipmap levels are created, Pool is D3DPOOL_MANAGED, Usage is 0, Format and size are taken from image. If you want to set those parameters to other values use CreateD3DTextureFromImage or CreateD3DTextureFromMultiImage instead.