Retrieving Material Properties
A version of this page is also available for
4/8/2010
You retrieve the material properties that the rendering device is currently using by calling the IDirect3DMobileDevice::GetMaterial method for the device. Unlike the IDirect3DMobileDevice::SetMaterial method, GetMaterial does not require preparation. The GetMaterial method accepts the address of a D3DMMATERIAL structure and fills the provided structure with information describing the current material properties before returning.
// For this example, the pd3dmDev variable is assumed to
// be a valid pointer to an IDirect3DMobileDevice interface.
HRESULT hr;
D3DMMATERIAL mat;
hr = pd3dmDev->GetMaterial(&mat);
if(FAILED(hr))
{
// Code to handle the error goes here.
}