IDirect3DDevice9::CreateCubeTexture method (d3d9.h)
Creates a cube texture resource.
Syntax
HRESULT CreateCubeTexture(
[in] UINT EdgeLength,
[in] UINT Levels,
[in] DWORD Usage,
[in] D3DFORMAT Format,
[in] D3DPOOL Pool,
[out, retval] IDirect3DCubeTexture9 **ppCubeTexture,
[in] HANDLE *pSharedHandle
);
Parameters
[in] EdgeLength
Type: UINT
Size of the edges of all the top-level faces of the cube texture. The pixel dimensions of subsequent levels of each face 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.
[in] Levels
Type: UINT
Number of levels in each face of the cube texture. If this is zero, Direct3D will generate all cube texture sublevels down to 1x1 pixels for each face for hardware that supports mipmapped cube textures. Call IDirect3DBaseTexture9::GetLevelCount to see the number of levels generated.
[in] Usage
Type: DWORD
Usage can be 0, which indicates no usage value. However, if usage is desired, use a combination of one or more D3DUSAGE constants. It is good practice to match the usage parameter in CreateCubeTexture with the behavior flags in IDirect3D9::CreateDevice. For more information, see Remarks.
[in] Format
Type: D3DFORMAT
Member of the D3DFORMAT enumerated type, describing the format of all levels in all faces of the cube texture.
[in] Pool
Type: D3DPOOL
Member of the D3DPOOL enumerated type, describing the memory class into which the cube texture should be placed.
[out, retval] ppCubeTexture
Type: IDirect3DCubeTexture9**
Address of a pointer to an IDirect3DCubeTexture9 interface, representing the created cube texture resource.
[in] pSharedHandle
Type: HANDLE*
Reserved. Set this parameter to NULL. This parameter can be used in Direct3D 9 for Windows Vista to share resources.
Return value
Type: HRESULT
If the method succeeds, the return value is D3D_OK. If the method fails, the return value can be one of the following: D3DERR_INVALIDCALL, D3DERR_OUTOFVIDEOMEMORY, E_OUTOFMEMORY.
Remarks
A mipmap (texture) is a collection of successively downsampled (mipmapped) surfaces. On the other hand, a cube texture (created by IDirect3DDevice9::CreateCubeTexture) is a collection of six textures (mipmaps), one for each face. All faces must be present in the cube texture. Also, a cube map surface must be the same pixel size in all three dimensions (x, y, and z).
An application can discover support for Automatic Generation of Mipmaps (Direct3D 9) in a particular format by calling IDirect3D9::CheckDeviceFormat with D3DUSAGE_AUTOGENMIPMAP. If IDirect3D9::CheckDeviceFormat returns D3DOK_NOAUTOGEN, IDirect3DDevice9::CreateCubeTexture will succeed but it will return a one-level texture.
Requirements
Requirement | Value |
---|---|
Target Platform | Windows |
Header | d3d9.h (include D3D9.h) |
Library | D3D9.lib |
See also
D3DXCreateCubeTextureFromFileEx
D3DXCreateCubeTextureFromFileInMemory
D3DXCreateCubeTextureFromFileInMemoryEx
D3DXCreateCubeTextureFromResource