Advertisement

Dear imgui and GLFW

Started by April 26, 2020 09:02 PM
7 comments, last by taby 4 years, 9 months ago

I'm setting up a new project that uses GLFW and Dear imgui. When I move my mouse over the GUI window it still passes along mouse events to the main window.

Is there a way to tell it to not pass the mouse movement to the main window?

Yes :-)

Please allow me a counterquestion first: how do you usually have your different game objects receive the user input ? ImGui ist just another one of those objects.

And actually, an example with glfw3 comes with imgui …

Advertisement

Thanks for your time.

Well, I'm using GLFW to handle mouse motion and clicks. I used to use freeglut and glui, and in that setup the control window did not pass through mouse motion and clicks.

I know it should be easy… I was told to state io.WantCaptureMouse = true; but that doesn't seem to make a difference.

I am basing my code off of that glfw3 imgui example that you mention, yeah. ?

H mm… I found a solution, of sorts. I now use ImGui::IsAnyWindowHovered() to detect if the dear imgui window is under the mouse cursor. Is this the best solution?

Now I have another question:

How do I set and get the text of a button?

Nevermind. I figured it out. ?

 

Advertisement

I've got the set generation working in the GLFW/dear imgui interface. The only problem is that the GPU-based algorithm runs really slow compared to the old multi-threaded project. The CPU-based algorithm works just fine. I'm having trouble pinpointing the problem. The code is at: https://github.com/sjhalayka/glfw_dear_imgui_test​​​

I'm aborting this project, and putting my focus back on the single-threaded https://github.com/sjhalayka/julia4d3

OK, for some magical reason, the GPU code in the GLFW/imgui multi-threaded app is working just fine now. I'm not sure why it was doing so poorly yesterday. For example, that picture in the above post shows that it takes like 6 seconds to compute the default mesh, where now it takes less than 1 second:

This topic is closed to new replies.

Advertisement