Microsoft DirectX 8.0 (Visual Basic)

Obtaining a Texture Surface Object

Texture resources are implemented in the Direct3DTexture8 class. To obtain a texture object, call the Direct3DDevice8.CreateTexture method or any of the following D3DX functions.

The following code example uses D3DX.CreateTextureFromFile to load a texture from Tiger.bmp.

'
' The following code example assumes that d3dDevice
' is a valid Direct3DDevice8 object and that g_D3DX is a valid
' D3DX8 object.
'
Dim Texture As Direct3DTexture8

Set Texture = g_D3DX.CreateTextureFromFile( d3dDevice, App.Path + "\tiger.bmp" )

The first parameter that CreateTextureFromFile accepts is a Direct3DDevice8 object. The second parameter tells Microsoft® Direct3D® the name of the file from which to load the texture. This method returns a texture object, which is assigned to Texture.