IDirect3DDevice8::CreateTexture
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] A combination of one or more of the following flags, describing the usage for this resource.
- 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.
- D3DUSAGE_DYNAMIC
- Set to indicate that the usage for the surface is dynamic. See Using Dynamic Textures for more information.
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
Header: Declared in D3d8.h.
Import Library: Use D3d8.lib.