Compartilhar via


IDirect3DMobileDevice::CreateTexture

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This method creates a texture resource.

Syntax

HRESULT CreateTexture(
  UINT Width,
  UINT Height,
  UINT Levels,
  DWORD Usage,
  D3DMFORMAT Format,
  D3DMPOOL Pool,
  IDirect3DMobileTexture** ppTexture
);

Parameters

  • Width
    [in] Width of the top-level of the texture, in pixels. The pixel dimensions of subsequent levels will be the truncated value of half of the previous level's pixel dimension (independently). Each dimension clamps at a size of 1 pixel. Thus, if the division by 2 results in 0 (zero), 1 will be taken instead.
  • Height
    [in] Height of the top-level of the texture, in pixels. The pixel dimensions of subsequent levels will be the truncated value of half of the previous level's pixel dimension (independently). Each dimension clamps at a size of 1 pixel. Thus, if the division by 2 results in 0 (zero), 1 will be taken instead.
  • Levels
    [in] The number of levels in the texture. If this is zero, Microsoft® Direct3D Mobile® will generate all texture sublevels down to 1×1 pixels for hardware that supports MIP mapped textures. Otherwise, it will create one level. Call IDirect3DMobileBaseTexture::GetLevelCount to see the number of levels generated.
  • Format
    [in] Member of the D3DMFORMAT enumerated type that describes the format of all levels in the texture.
  • Pool
    [in] Member of the D3DMPOOL enumerated type that describes the memory class into which the texture should be placed.
  • ppTexture
    [out] Address of a pointer to an IDirect3DMobileTexture interface that represents the created texture resource.

Return Value

If the values for Height and Width requested are greater than the maximum allowed texture dimensions, as defined by the D3DMCAPS structure members MaxTextureWidth and MaxTextureHeight, then the method returns D3DMERR_DRIVERUNSUPPORTED.

If the range specified is within the texture dimension maximums and there is insufficient memory to allocate the texture then D3DMERR_MEMORYPOOLEMPTY (see D3DMERR Values) is returned.

This method can also return D3DMERR_INVALIDCALL and E_OUTOFMEMORY.

Remarks

To call IDirect3DMobileDevice::SetRenderTarget with a texture, you must select a level using IDirect3DMobileTexture::GetSurfaceLevel and pass the resulting surface to IDirect3DMobileDevice::SetRenderTarget.

Requirements

Header d3dm.h
Library D3dm.lib, D3dmguid.lib
Windows Embedded CE Windows CE 5.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

IDirect3DMobileDevice
IDirect3DMobileBaseTexture::GetLevelCount
D3DMUSAGE Values
IDirect3DMobile::CheckDeviceFormat
D3DMFORMAT
D3DMPOOL
IDirect3DMobileTexture
D3DMCAPS
D3DMERR Values
IDirect3DMobileTexture::GetSurfaceLevel