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

You can retrieve all the properties for an existing light source from C++ by calling the IDirect3DMobileDevice::GetLightmethod for the device. When calling the GetLightmethod, pass in the first parameter the zero-based index of the light source for which the properties will be retrieved, and supply the address of a D3DMLIGHTstructure in the second parameter. The device fills the D3DMLIGHTstructure to describe the lighting properties it uses for the light source at that index.

The following code example shows this process.

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

// Get the property information for the first light.
hr = pd3dmDevice->GetLight(0, &light);
if (FAILED(hr))
{
	// Code to handle the error goes here.
}

If you supply an index outside the range of the light sources assigned in the device, the GetLightmethod fails, returning D3DMERR_INVALIDCALL (see D3DMERR Values).

See Also

Concepts

Using Lights