Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
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::GetLevelCountto see the number of levels generated.

Usage

[in] Set this to the flag D3DMUSAGE_RENDERTARGET (see D3DMUSAGE Values) to indicate that the surface is to be used as a render target. The resource can be passed to the pRenderTargetparameter of IDirect3DMobileDevice::SetRenderTarget. You can check that the device supports this operation by calling IDirect3DMobile::CheckDeviceFormat.

Format

[in] Member of the D3DMFORMATenumerated type that describes the format of all levels in the texture.

Pool

[in] Member of the D3DMPOOLenumerated type that describes the memory class into which the texture should be placed.

ppTexture

[out] Address of a pointer to an IDirect3DMobileTextureinterface that represents the created texture resource.

Return Value

If the values for Heightand Widthrequested are greater than the maximum allowed texture dimensions, as defined by the D3DMCAPSstructure members MaxTextureWidthand 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::SetRenderTargetwith a texture, you must select a level using IDirect3DMobileTexture::GetSurfaceLeveland 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