Platform SDK: DirectX

Direct3DDevice7.SetTexture

The Direct3DDevice7.SetTexture method assigns a texture to a given stage for a device.

object.SetTexture( _ 
    stage As Long, _ 
    texture As DirectDrawSurface7)

Parameters

object
Object expression that resolves to a Direct3DDevice7 object.
stage
Stage identifier to which the texture will be set. Stage identifiers are zero-based. Currently, devices can have up to 8 set textures, so the maximum allowable value for stage is 7.
texture
A DirectDrawSurface7 object for the texture being set. For complex textures, such as mipmaps and cubic environment maps, this parameter must be the top-level surface.

Error Codes

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

DDERR_INVALIDOBJECT
DDERR_INVALIDPARAMS

For information on trapping errors, see the Visual Basic Error Trapping topic.

Remarks

When the texture is no longer needed, you should set the texture at the appropriate stage to Nothing. If you fail to do this, the memory for the surface may be lost when your application closes.

Software devices do not support assigning a texture to more than one texture stage at a time.

See Also

Direct3DDevice7.GetTexture, Direct3DDevice7.GetTextureStageState, Direct3DDevice7.SetTextureStageState, Textures