Direct3DDevice8.CreateCubeTexture
Creates a cube texture resource.
object.CreateCubeTexture( _
EdgeLength As Long, _
Levels As Long, _
Usage As Long, _
Format As CONST_D3DFORMAT, _
Pool As CONST_D3DPOOL) As Direct3DCubeTexture8
Parts
- object
- Object expression that resolves to a Direct3DDevice8 object.
- EdgeLength
- Size of the edges of all the top-level faces of the cube texture. The pixel dimensions of subsequent levels of each face are the truncated value of half of the previous level's pixel dimension (independently). Each dimension clamps at a size of 1 pixel. If the division by 2 results in 0, 1 will be taken instead.
- Levels
- The number of levels in each face of the cube texture. If this is 0 (zero), Microsoft® Direct3D® will generate all cube texture sublevels down to 1×1 pixels for each face for hardware that supports mipmapped cube textures. Otherwise, it will create one level. Call Direct3DBaseTexture8.GetLevelCount to see the number of levels generated.
- Usage
- A combination of one or more of the following flags defined by the CONST_D3DUSAGEFLAGS enumeration, 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 NewDepthStencil parameter of the Direct3DDevice8.SetRenderTarget method. See Remarks.
- D3DUSAGE_RENDERTARGET
- Set to indicate that the surface is to be used as a render target. The resource can be passed to the NewRenderTarget parameter of the SetRenderTarget method. See Remarks.
- 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 Direct3D8.CheckDeviceFormat.
- Format
- Member of the CONST_D3DFORMAT enumeration, describing the format of all levels in all faces of the cube texture.
- Pool
- Member of the CONST_D3DPOOL enumeration, describing the memory class into which the cube texture should be placed.
Return Values
A Direct3DCubeTexture8 object, representing the created cube texture resource.
Error Codes
If the method fails, an error is raised and Err.Number can be set to one of the following values.
For information on trapping errors, see the Microsoft® Visual Basic® Error Handling topic.
Remarks
Cube textures differ from other surfaces in that they are collections of surfaces. To call SetRenderTarget with a cube texture, you must select an individual face using Direct3DCubeTexture8.GetCubeMapSurface and pass the resulting surface to SetRenderTarget.
A texture (mipmap) is a collection of successively downsampled (mipmapped) surfaces. On the other hand, a cube texture (created by 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).
In Microsoft® DirectX® 8.x, resource usage is enforced. An application that wishes to use a resource in a certain operation must specify that operation at resource creation time.