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 discussed for objects (see Direct3D Driver Interface) apply to Direct3D textures. It is possible to use a single DirectDrawSurface as both a rendering target and a texture.