Releasing the Direct3D Device

The ReleaseDevice function releases the Direct3D device and its associated surfaces.

static HRESULT

ReleaseDevice(void)

{

if (NULL != lpd3dDevice)

{

lpd3dDevice->lpVtbl->Release(lpd3dDevice);

lpd3dDevice = NULL;

}

if (NULL != lpddZBuffer)

{

lpddZBuffer->lpVtbl->Release(lpddZBuffer);

lpddZBuffer = NULL;

}

if (NULL != lpddDevice)

{

lpddDevice->lpVtbl->Release(lpddDevice);

lpddDevice = NULL;

}

return DD_OK;

}