Microsoft DirectX 8.0 (C++) |
You retrieve the material properties that the rendering device is currently using by calling the IDirect3DDevice8::GetMaterial method for the device. Unlike the IDirect3DDevice8::SetMaterial method, GetMaterial doesn't require preparation. The GetMaterial method accepts the address of a D3DMATERIAL8 structure, and fills the provided structure with information describing the current material properties before returning.
// For this example, the pd3dDev variable is assumed to // be a valid pointer to an IDirect3DDevice8 interface. HRESULT hr; D3DMATERIAL8 mat; hr = pd3dDev->GetMaterial(&mat); if(FAILED(hr)) { // Code to handle the error goes here. }