IDirect3DDevice8::CreateTexture
This method creates a texture resource.
HRESULT CreateTexture(
UINT Width,
UINT Height,
UINT Levels,
DWORD Usage,
D3DFORMAT Format,
D3DPOOL Pool,
IDirect3DTexture8** 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® will generate all texture sublevels down to 1×1 pixels for hardware that supports MIP mapped textures. Otherwise, it will create one level. Call IDirect3DBaseTexture8::GetLevelCount to see the number of levels generated.Usage
[in] Combination of one or more of the following flags, describing the usage for this resource.Flag Description D3DUSAGE_DEPTHSTENCIL Set to indicate that the surface is to be used as a depth-stencil surface. The resource can be passed to the pNewZStencil parameter of the IDirect3DDevice8::SetRenderTarget method. D3DUSAGE_RENDERTARGET Set to indicate that the surface is to be used as a render target. The resource can be passed to the pRenderTarget parameter of SetRenderTarget. If either D3DUSAGE_RENDERTARGET or D3DUSAGE_DEPTHSTENCIL is specified, the application should check that the device supports these operations by calling IDirect3D8::CheckDeviceFormat.
Format
[in] Member of the D3DFORMAT enumerated type, describing the format of all levels in the texture.Pool
[in] Member of the D3DPOOL enumerated type, describing the memory class into which the texture should be placed.ppTexture
[out, retval] Address of a pointer to an IDirect3DTexture8 interface, representing the created texture resource.
Return Values
If the method succeeds, the return value is D3D_OK.
If the method fails, the return value can be one of the following values:
Remarks
In order to call IDirect3DDevice8::SetRenderTarget with a texture, you must select a level using IDirect3DTexture8::GetSurfaceLevel and pass the resulting surface to SetRenderTarget.
Requirements
OS Versions: Windows CE .NET 4.0 and later.
Header: D3d8.h.
Link Library: D3d8.lib.
See Also
D3DFORMAT | D3DPOOL | IDirect3DTexture8 | IDirect3D8::CheckDeviceFormat | IDirect3DBaseTexture8::GetLevelCount | IDirect3DDevice8::SetRenderTarget | IDirect3DTexture8::GetSurfaceLevel | IDirect3DDevice8
Last updated on Thursday, April 08, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.