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

Using QtImGui with multiple QOpenGLWidgets? #41

Open
stephkno opened this issue Jun 2, 2022 · 1 comment
Open

Using QtImGui with multiple QOpenGLWidgets? #41

stephkno opened this issue Jun 2, 2022 · 1 comment

Comments

@stephkno
Copy link

stephkno commented Jun 2, 2022

Is it possible to use QtImGui with multiple QOpenGLWidgets sharing the same class? I'm calling QtImGui functions while QOpenGLWidget is underMouse() which prevents crashing but ImGui does not render in the other active viewports, only the first one.

@tatolevicz
Copy link

tatolevicz commented Oct 16, 2022

Hey @stephkno are you initializing the QtImgui as the default renderer? I had a similar issue and when I saw the "multiple" example I understood what I was doing wrong. So check if you are saving the the renderRef and ImplotContext like this:

ref = QtImGui::initialize(this, false);
ctx = ImPlot::CreateContext();

and not just initializing as the default renderer:

 QtImGui::initialize(this);

so you can reuse it in the paintGL function:

QtImGui::newFrame(ref);
ImPlot::SetCurrentContext(ctx);

//rendering code here

ImGui::Render();
QtImGui::render(ref);

I have multiple widgets using the same OpenGLWIdget subclass with no problem now as you can see in the image below
(ChartView is the QtImgui widget = )):

Captura de Tela 2022-10-16 às 10 18 45

Best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants