Closed natxopedreira closed 3 years ago
Hey,
Supposing your code runs fine on other platforms, I'd start checking here if the mouse state is set correctly. If not, that could help you tell if the issue is oF related or ofxImGui related. The BaseEngine
(or child) class should set the mousePressed
state every frame.
(I've no experience with either rt-boards or egl windows.)
Thank you!!
Coords look correct but im not sure about index, i mean if i click mouse left click do you know wich index is correct¿ for me mouse lef is index 1 and right is index 3.
engine.mousePressed[i] returns 1 when click
for (int i = 0; i < 5; i++) {
io.MouseDown[i] = engine.mousePressed[i];
}
The (default) BaseEngine
behaviour is here but it can be overridden by the childEngine.
It looks like the ofEvent buttons are window-implementation-dependent : GLFW uses for example this code where the oF button number is mapped to the GLFW ones. So maybe you need to check the EGL specs ?
ofxImGui tries to guess the needed engine, but the else
case chooses EngineGLFW
, so you're probably using that one` on an EGL window. (because EGL is [I think] unimplemented in ofxImGui)
I understand what you say, but rendering is opengles, i had a typo on first post (i had opengl) so EngineOpenGLES (i checked), in fact i see rollover on widgets so we can assume that mouse coords are passing to imgui.
EDIT: I chechek and mouseDown go to https://github.com/ocornut/imgui/blob/04fd5072fbc635cc7a8814b8543d40836248d3a7/imgui.cpp#L3642
Sure is a dumb detail.... but i can not find where the problem is.
What im missing? is there something like check if click inside widget or like in any point is translating mouseDown to other event that is used to set click to widget...
Thank you
Hard to say, could be anything. Beware, your link points to another imgui version than the one in ofxImGui. Maybe try to show the imgui metrics window and check for anomalies ? (you can see imgui's inner state there)
i just found the problem
index for buttons do not match and also mask do not match,i can fix index but i dont understand how mask works https://github.com/jvcleave/ofxImGui/blob/330e1425a88de7babd53ceb2fb93f8109b61724c/libs/imgui/src/imgui_internal.h#L452
i understand is related to those https://github.com/openframeworks/openFrameworks/blob/7c46c8a9415703c1cf7ce1bb66c91cc97851fa19/libs/openFrameworks/app/ofAppEGLWindow.cpp#L85
Can you point me where to learn how those mas works? so i can find the correct relation.
I know those two are the problems as i made a quick hack and now i get click on buttons and sliders
Thank you
Sounds complicated to me, not sure you're looking at the right place...
The mouse state goes from EGL -> ofAppEGLWindow [oF] -> Engine[ofxImGui] -> DearImGui
. IMO, that ImGuiButtonFlags_
have nothing to do with your issue, here's more info if you wanna learn them.
If the indexes are wrong, I'd try something like this but within EngineOpenGLES::mousePressed
(which you need to create, and rebind).
Yep i have it working in a not much elegant way, but hey it works :)
I think masking are related because here are used to set the state of pressed https://github.com/ocornut/imgui/blob/04fd5072fbc635cc7a8814b8543d40836248d3a7/imgui_widgets.cpp#L553
Problem was incorrect indexes and that masking do not match, when i have time will do a EngineEGL
Funny thing is that this give me a clue to make Fbo works on egl/rockchip as i can draw an fbo to the guy but not directly on screen so i know that error must be on drawing part
Thank you so much for your help!!!
// Poll buttons
int mouse_button_clicked = -1;
int mouse_button_released = -1;
if ((flags & ImGuiButtonFlags_MouseButtonLeft) && g.IO.MouseClicked[0]) { mouse_button_clicked = 0; }
else if ((flags & ImGuiButtonFlags_MouseButtonRight) && g.IO.MouseClicked[1]) { mouse_button_clicked = 1; }
else if ((flags & ImGuiButtonFlags_MouseButtonMiddle) && g.IO.MouseClicked[2]) { mouse_button_clicked = 2; }
if ((flags & ImGuiButtonFlags_MouseButtonLeft) && g.IO.MouseReleased[0]) { mouse_button_released = 0; }
else if ((flags & ImGuiButtonFlags_MouseButtonRight) && g.IO.MouseReleased[1]) { mouse_button_released = 1; }
ok, great. Don't hesitate to make an EngineEGL or simply share some more code when you find new fixes.
As for your Fbo issue, sounds like a GL context restore issue; to diagnostic, try your fbo stuff without loading/using ofxImGui : if the FBO works it might be related to that.
i need to test again the gui because i found how to make glfw work using egl so i suppose that then no need to create a "engine wrapper" will test soon.
Will take a look at what you say for fbo, for now i discovered that if i attach the fbo texture to a plane it renders ok but i need to flip it with a shader..... im close to have all working
will post on forum when everything works for people reference
Hello
I like that gui so much.... and now im working with oF in rk boards, i managed to all works except fbo.... but thats not the case.
I wanted to use that gui but problem is that i can not click on menus??? they dont respond, i see the event is propaged to BaseEngine so not sure where the problem exist if here or in imgui
Im using a egl window with opengles3.2, do you have any clue??
Note: coordinates must be correct as i can hover elements
Thanks!