Direct3D Texture Interface

Direct3D textures are not distinct object types, but rather another interface of DirectDrawSurface objects. The following example obtains a Direct3D texture interface from a DirectDrawSurface object:

LPDIRECTDRAWSURFACE lpDDSurface;

LPDIRECT3DTEXTURE lpD3DTexture;

ddres = lpDD->CreateSurface(&ddsd, &lpDDSurface,

NULL);

if (FAILED(ddres))

.

.

.

ddres = lpDDSurface->QueryInterface(

IID_IDirect3DTexture, &lpD3DTexture);

if (FAILED(ddres))

.

.

.

The same rules for reference counts and state lifetimes for objects apply to Direct3D textures. (For information about these rules, see Direct3D Driver Interface.) It is possible to use a single DirectDrawSurface object as both a rendering target and a texture.