Microsoft DirectX 8.0 (C++)

Obtaining a Texture Surface Object

Texture resources are implemented in the IDirect3DTexture8 interface. To obtain a pointer to a texture interface, call the IDirect3DDevice8::CreateTexture method or any of the following D3DX functions.

The following code example uses D3DXCreateTextureFromFileA to load a texture from Tiger.bmp.

// The following code example assumes that d3dDevice
// is a valid pointer to an IDirect3DDevice8 interface.

LPDIRECT3DTEXTURE8 pTexture;

D3DXCreateTextureFromFile( d3dDevice, "tiger.bmp", &pTexture);

The first parameter that D3DXCreateTextureFromFile accepts is a pointer to a IDirect3DDevice8 interface. The second parameter tells Microsoft® Direct3D® the name of the file from which to load the texture. The third parameter takes the address of a pointer to a IDirect3DTexture8 interface, representing the created texture object.