Microsoft DirectX 8.1 (Visual Basic)

Direct3DDevice8.CreateTexture

Creates a texture resource.

object.CreateTexture( _ 
    Width As Long, _ 
    Height As Long, _ 
    Levels As Long, _ 
    Usage As Long, _ 
    Format As CONST_D3DFORMAT, _ 
    Pool As CONST_D3DPOOL) As Direct3DTexture8

Parts

object
Object expression that resolves to a Direct3DDevice8 object.
Width
Width of the top-level of the texture, in pixels. 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. If the division by 2 results in 0, 1 will be taken instead.
Height
Height of the top-level of the texture level, in pixels. 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. If the division by 2 results in 0, 1 will be taken instead.
Levels
The number of levels in the texture. If this is 0 (zero), Microsoft® Direct3D® will generate all texture sub-levels down to 1×1 pixels for hardware that supports MIP mapped 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.
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.
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 the texture.
Pool
Member of the CONST_D3DPOOL enumeration, describing the memory class into which the texture should be placed.

Return Values

A Direct3DTexture8 object, representing the created texture resource.

Error Codes

If the method fails, an error is raised and Err.Number can be set to one of the following values.

D3DERR_INVALIDCALL
D3DERR_OUTOFVIDEOMEMORY
E_OUTOFMEMORY

For information on trapping errors, see the Microsoft® Visual Basic® Error Handling topic.

Remarks

In order to call Direct3DDevice8.SetRenderTarget with a texture, you must select a level using Direct3DTexture8.GetSurfaceLevel and pass the resulting surface to SetRenderTarget.