Microsoft DirectX 8.0 (Visual Basic)

Retrieving Light Properties

A Microsoft® Visual Basic® application retrieves the properties for an existing light source by calling the Direct3DDevice8.GetLight method for the device. When calling the GetLight method, pass in the first parameter the zero-based index of the light source for which the properties will be retrieved, and a variable of type D3DLIGHT8 as the second parameter. The device fills the D3DLIGHT8 type to describe the lighting properties it uses for the light source at that index.

The following code example illustrates this process.

'
' For the purposes of this example, the d3dDevice variable contains
' a valid reference to a Direct3DDevice8 object.
'
Dim lightDesc As D3DLIGHT8

' Get the property information for the first light.
Call d3dDevice.GetLight(0, lightDesc)
If Err.Number <> D3D_OK Then
    ' Code to handle the error goes here.
End If

If you supply an index outside the range of the light sources assigned in the device, the GetLight method fails, and the value of Err.Number is D3DERR_INVALIDCALL.