Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix window resizing in SDL+DX11 example #3057

Closed
wants to merge 1 commit into from

Conversation

joeslay
Copy link
Contributor

@joeslay joeslay commented Mar 11, 2020

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 is what happens if I resize initial window currently: mouse doesn't hit detect on the controls properly (mouse not shown, but it's actually hovering in the blue), scaling makes it unreadable.
image

with the new code:

image.

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).
@ocornut ocornut changed the title Improve window resizing in dx11 example Fix window resizing in SDL+DX11 example Mar 11, 2020
ocornut pushed a commit that referenced this pull request Mar 11, 2020
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).
@ocornut
Copy link
Owner

ocornut commented Mar 11, 2020

Thank you @joeslay, it was weirdly overlooked because the other DX11 example are doing that in their WndProc handler. I pushed an additional commit to compare the WindowId (so it works with multi-viewports) and changed the code to use CleanupRenderTarget() + ResizeBuffers() + CreateRenderTarget() as with the other DX11 example.

I removed g_pd3dDeviceContext->OMSetRenderTargets(0, 0, 0); because even though it makes senses the other DX11 example never did that, tried to enable D3D11_CREATE_DEVICE_DEBUG and didn't get any issue so I assume it isn't required.

Thanks again!

@ocornut ocornut closed this Mar 11, 2020
sergeyn pushed a commit to sergeyn/imgui that referenced this pull request Mar 30, 2020
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).
sergeyn pushed a commit to sergeyn/imgui that referenced this pull request Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants