admin管理员组文章数量:1304152
I have an application that uses DirectX 9. However, when I resize the window from the edge with the mouse, I cannot successfully reset the device. I am getting a D3DERR_INVALIDCALL
error. I am comparing the parameters that were first created when the application was opened with the parameters after the window is resized, and everything looks the same (LogD3DPresentParameters(d3dpp)
).
What could I be missing?
void OnSizeChange(int width, int height){
if (!createdDevice)
return;
HRESULT hr;
RECT rcWnd;
GetClientRect(&rcWnd);
UINT uWidth = rcWnd.right - rcWnd.left;
UINT uHeight = rcWnd.bottom - rcWnd.top;
IDirect3DDevice9& rkD3DDev = *STATEMANAGER.GetDevice();
HWND currentHWND = m_grpDevice.GetDeviceParameter().hDeviceWindow;
d3dpp.BackBufferWidth = uWidth;
d3dpp.BackBufferHeight = uHeight;
hr = STATEMANAGER.GetDevice()->TestCooperativeLevel();
if (FAILED(hr))
{
if (hr == D3DERR_DEVICELOST)
return;
if (hr == D3DERR_DEVICENOTRESET)
{
m_grpDevice.DestroyPDTVertexBufferListtt();
if (FAILED(hr = rkD3DDev.Reset(&d3dpp)))
{
LogD3DPresentParameters(d3dpp);
char szError[512];
snprintf(szError, sizeof(szError),
"Cihaz sıfırlama hatası! HRESULT: 0x%08X\nHata: %s\nAçıklama: %s",
hr,
DXGetErrorString(hr),
DXGetErrorDescription(hr));
MessageBox(NULL, szError, "Hata", MB_OK | MB_ICONERROR);
return;
}
STATEMANAGER.SetDefaultState();
if (!m_grpDevice.CreatePDTVertexBufferListtt())
TraceError("m_grpDevice.CreatePDTVertexBufferListtt() - ERROR!");
}
}
}
本文标签: cHow can I reset the device after resizing the window with DirectX 9Stack Overflow
版权声明:本文标题:c++ - How can I reset the device after resizing the window with DirectX 9? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741775632a2397007.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论