ID3D10Device::CreateTexture2D method (d3d10.h)

Create an array of 2D textures (see Texture2D).

Syntax

HRESULT CreateTexture2D(
  [in]  const D3D10_TEXTURE2D_DESC   *pDesc,
  [in]  const D3D10_SUBRESOURCE_DATA *pInitialData,
  [out] ID3D10Texture2D              **ppTexture2D
);

Parameters

[in] pDesc

Type: const D3D10_TEXTURE2D_DESC*

Pointer to a 2D texture description (see D3D10_TEXTURE2D_DESC). To create a typeless resource that can be interpreted at runtime into different, compatible formats, specify a typeless format in the texture description. To generate mipmap levels automatically, set the number of mipmap levels to 0.

[in] pInitialData

Type: const D3D10_SUBRESOURCE_DATA*

Pointer to an array of subresource descriptions (see D3D10_SUBRESOURCE_DATA); one for each subresource (ordered by texture array index, then mip level). Applications may not specify NULL for pInitialData when creating IMMUTABLE resources (see D3D10_USAGE). If the resource is multisampled, pInitialData must be NULL because multisampled resources cannot be initialized with data when they are created.

[out] ppTexture2D

Type: ID3D10Texture2D**

Address of a pointer to the created texture (see ID3D10Texture2D Interface). Set this parameter to NULL to validate the other input parameters (the method will return S_FALSE if the other input parameters pass validation).

Return value

Type: HRESULT

If the method succeeds, the return code is S_OK. See Direct3D 10 Return Codes for failing error codes.

Remarks

CreateTexture2D creates a 2D texture resource, which contains an array of 1D textures. The number of textures is specified in the texture description. All textures in a resource must have the same format, size, and number of mipmap levels.

All resources are made up of one or more subresources. To load data into the texture, applications may supply the data initially as part of D3D10_SUBRESOURCE_DATA structure pointed to by pInitialData, or it may use one of the Texturing Functions supplied by the SDK.

Requirements

Requirement Value
Target Platform Windows
Header d3d10.h
Library D3D10.lib

See also

ID3D10Device Interface