ocornut / imgui

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
MIT License
59.41k stars 10.12k forks source link

Resizing problem when using a glfw window with directx 11 #4870

Open Ack008 opened 2 years ago

Ack008 commented 2 years ago

Hi everyone. I'm trying to create my own game engine using ImGui. I programmed in such a way that i can choose which API I can use to render the scene, I can choose between Directx 11 and Opengl, but in both cases i use a glfw window. With Opengl everything is fine, the problem comes with the second one. 2022-01-06 (1) 2022-01-06 (2) 2022-01-06 (3)

The problem comes when i resize the window while I'm using the Directx11. When I resize it resize the swap chain, so i don't think that the problem is in the directx settings itself. In order to inizialize ImGui for D3DX11 I use the following code:

Also the input coordinates are wrong after the resize, for example, also if I click outside the imgui window, imgui detect that I'm inside of it, otherwise, if I'm touching the window, ImGui doesn't detect it.

(Sorry for the bad english).

ocornut commented 2 years ago

Check the value of io.DisplaySize and how it is updated by ImGui_ImplGlfw_NewFrame(). Perhaps some of the function there don't work with that specific setup? Also print the value of io.MousePos to see which side of the fence may be wrong.

Mystixor commented 1 month ago

I have the same problem in Win32 with DX11. I checked io.DisplaySize and io.MousePos and the values are updated correctly. Nonetheless, resizing the window stretches ImGui just as shown above.