D3DXCreateTexture

This function creates an empty texture, adjusting the calling parameters as needed.

HRESULT D3DXCreateTexture(
  LPDIRECT3DDEVICE8 pDevice,
  UINT Width,
  UINT Height,
  UINT MipLevels,
  DWORD Usage,
  D3DFORMAT Format,
  D3DPOOL Pool,
  LPDIRECT3DTEXTURE8* ppTexture
);

Parameters

  • pDevice
    [in] Pointer to an IDirect3DDevice8 interface, representing the device to be associated with the texture.
  • Width
    [in] Width in pixels. This value must be non-zero.
  • Height
    [in] Height in pixels. This value must be non-zero.
  • MipLevels
    [in] Number of mip levels requested. If this value is zero or D3DX_DEFAULT, a complete mipmap chain is created.
  • Usage
    [in] 0 or D3DUSAGE_RENDERTARGET. Setting this flag to D3DUSAGE_RENDERTARGET indicates that the surface is to be used as a render target. The resource can then be passed to the pNewRenderTarget parameter of the SetRenderTarget method. If D3DUSAGE_RENDERTARGET is specified, the application should check that the device supports this operation by calling IDirect3D8::CheckDeviceFormat.
  • Format
    [in] Member of the D3DFORMAT enumerated type, describing the requested pixel format for the texture. The returned texture might have a different format from that specified by Format. Applications should check the format of the returned texture.
  • Pool
    [in] Member of the D3DPOOL enumerated type, describing the memory class into which the texture should be placed.
  • ppTexture
    [out] Address of a pointer to an IDirect3DTexture8 interface, representing the created texture object.

Return Values

If the function succeeds, the return value is D3D_OK.

If the function fails, the return value can be one of the following values.

D3DERR_NOTAVAILABLE
D3DERR_OUTOFVIDEOMEMORY
D3DERR_INVALIDCALL
E_OUTOFMEMORY

Remarks

Internally, D3DXCreateTexture uses D3DXCheckTextureRequirements to adjust the calling parameters. Therefore, calls to D3DXCreateTexture will often succeed where calls to IDirect3Ddevice8::CreateTexture would fail.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: D3dx8tex.h.
Link Library: D3dx8.lib.

See Also

D3DXCheckTextureRequirements | IDirect3DDevice8 | IDirect3DTexture8 | IDirect3Ddevice8::CreateTexture | IDirect3D8::CheckDeviceFormat

 Last updated on Thursday, April 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.