DirectX SDK

IDirect3DDevice7::LightEnable

The IDirect3DDevice7::LightEnable method enables or disables a set of lighting parameters within a device.

HRESULT LightEnable( 
  DWORD dwLightIndex,
  BOOL bEnable
); 

Parameters

dwLightIndex
Zero-based index of the set of lighting parameters that are the target of this method.
bEnable
Value indicating if the set of lighting parameters are being enabled or disabled. Set this parameter to TRUE to enable lighting with the parameters at the specified index, or FALSE to disable it.

Return Values

If the method succeeds, the return value is D3D_OK.

If the method fails, the return value is an error. For a complete list of Direct3D Immediate Mode error values and descriptions, see Return Values.

Remarks

If you supply a value for dwLightIndex outside the range of the light property sets currently assigned within the device, the LightEnable method creates a light source with the following properties and sets its enabled state to the value specified in bEnable:

Member Default
dltType D3DLIGHT_DIRECTIONAL
dcvDiffuse (R:1, G:1, B:1, A:0)
dcvSpecular (R:0, G:0, B:0, A:0)
dcvAmbient (R:0, G:0, B:0, A:0)
dvPosition (0, 0, 0)
dvDirection (0, 0, 1)
dvRange 0
dvFalloff 0
dvAttenuation0 0
dvAttenuation1 0
dvAttenuation2 0
dvTheta 0
dvPhi 0

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Windows CE: Unsupported.
  Version: Requires DirectX 7.0.
  Header: Declared in d3d.h.

See Also

IDirect3DDevice7::GetLight, IDirect3DDevice7::GetLightEnable, IDirect3DDevice7::SetLight, Lighting and Materials