Giter Club home page Giter Club logo

Comments (10)

Daandelange avatar Daandelange commented on August 16, 2024

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.)

from ofximgui.

natxopedreira avatar natxopedreira commented on August 16, 2024

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];
}

from ofximgui.

Daandelange avatar Daandelange commented on August 16, 2024

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)

from ofximgui.

natxopedreira avatar natxopedreira commented on August 16, 2024

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.

  • coords works because i see rollover
  • mouseDown propagate

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

from ofximgui.

Daandelange avatar Daandelange commented on August 16, 2024

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)

from ofximgui.

natxopedreira avatar natxopedreira commented on August 16, 2024

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

enum ImGuiButtonFlags_

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

from ofximgui.

Daandelange avatar Daandelange commented on August 16, 2024

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).

from ofximgui.

natxopedreira avatar natxopedreira commented on August 16, 2024

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; }

from ofximgui.

Daandelange avatar Daandelange commented on August 16, 2024

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.

from ofximgui.

natxopedreira avatar natxopedreira commented on August 16, 2024

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

from ofximgui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.