Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

Once you assign a set of light properties for a light source in a scene, the light source can be activated by calling the IDirect3DMobileDevice::LightEnablemethod for the device. New light sources are disabled by default. The LightEnablemethod accepts two parameters. Set the first parameter to the zero-based index of the light source to be affected by the method, and set the second parameter to TRUE to enable the light or FALSE to disable it.

The following code example shows the use of this method by enabling the first light source in the device's list of light source properties.

Copy Code
/*
 * For the purposes of this example, the d3dmDevice variable
 * is a valid pointer to an IDirect3DMobileDevice interface.
 */
HRESULT hr;

hr = pd3dmDevice->LightEnable(0, TRUE);
if (FAILED(hr))
{
	// Code to handle the error goes here.
}

If you enable or disable a light that has no properties that are set with IDirect3DMobileDevice::SetLight, the LightEnablemethod creates a light source with the properties shown in following table and enables or disables it.

Member Default

Type

D3DLIGHT_DIRECTIONAL

Diffuse

(R:1, G:1, B:1, A:0)

Specular

(R:0, G:0, B:0, A:0)

Ambient

(R:0, G:0, B:0, A:0)

Position

(0, 0, 0)

Direction

(0, 0, 1)

Range

0

Falloff

0

Attenuation0

0

Attenuation1

0

Attenuation2

0

Theta

0

Phi

0

See Also

Concepts

Using Lights