Sign in to follow this  

Resetting the Device

This topic is 4678 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am having trouble resetting the display device. I know that Present() returns an error if the device is lost so I call Reset() on the device with an in-class-stored D3DPRESENT_PARAMETERS structure. The code used is as follows:
bool cVideo::EndFrame()
{
  HRESULT result;
  
  if(SUCCEEDED(m_device->EndScene())) 
    if(SUCCEEDED(result = m_device->Present(NULL, NULL, NULL, NULL)))
      return true;
    else
    {
      if(result == D3DERR_DEVICELOST)
        m_device->Reset(&m_present);
    }
   
  return false;
}
I have no resources loaded and the default screen color is grey and is cleared to black at the beginning of the frame. However when the device is lost the screen is no longer cleared as it should be. Just for reference, the code to begin the scene is as follows:
bool cVideo::BeginFrame()
{
  if(SUCCEEDED(m_device->Clear(0, NULL, D3DCLEAR_TARGET, SYS_ColorBlack, 1.0f, 0)))
    if(SUCCEEDED(m_device->BeginScene()))
      return true;
  
  return false; 
}

Share this post


Link to post
Share on other sites
Sign in to follow this