Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ID3D10Device::CreateTexture2D method

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


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


pDesc [in]

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.

pInitialData [in]


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.

ppTexture2D [out]

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


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


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.






See also

ID3D10Device Interface



© 2017 Microsoft