Improve resizing in dx11 example (#3057)
Make the dx11 example implementation resize the window in a sane way, i.e. not the stretching/scaling the initial render to fit the new window size (current behaviour).
This commit is contained in:
parent
a5041c8820
commit
a0f01d2290
@ -101,6 +101,15 @@ int main(int, char**)
|
||||
done = true;
|
||||
if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(window))
|
||||
done = true;
|
||||
if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_RESIZED)
|
||||
{
|
||||
g_pd3dDeviceContext->OMSetRenderTargets(0, 0, 0);
|
||||
// Release all outstanding references to the swap chain's buffers.
|
||||
g_mainRenderTargetView->Release();
|
||||
|
||||
g_pSwapChain->ResizeBuffers(0, 0, 0, DXGI_FORMAT_UNKNOWN, 0);
|
||||
CreateRenderTarget();
|
||||
}
|
||||
}
|
||||
|
||||
// Start the Dear ImGui frame
|
||||
|
Loading…
Reference in New Issue
Block a user