C++ Вопрос MultiThreaded ImGui ( Multiple windows)

Начинающий
Статус
Оффлайн
Регистрация
26 Июн 2022
Сообщения
10
Реакции[?]
4
Поинты[?]
4K
Hi, Im trying to make a multihreaded imgui overlay. I have a main menu but i want to draw to another window too at the same time using imgui.
I tried everything like SetContext and mutex locking too but my code always fails as soon as i start to init / render my new imgui window in my thread.
I understand that imgui is not thread safe at all but since i want to two different windows with immgui on it I'm gonna have to use a thread.
Anyone ever achieved something like this or figured out how to draw 2 windows with completely new init and backend?
 
feel irl
Участник
Статус
Оффлайн
Регистрация
21 Дек 2018
Сообщения
677
Реакции[?]
294
Поинты[?]
16K
You should use one thread for rendering imgui, but you can use multithreading for some stuffs like parallelism(I've read that imgui can't use a double init or kinda in that way).
You can pm me, if you wanna get help with something. Perhaps I can help you.
Пожалуйста, авторизуйтесь для просмотра ссылки.
Maybe it'll help you or give some ideas.
 
Femboy Access
Эксперт
Статус
Оффлайн
Регистрация
11 Ноя 2020
Сообщения
1,330
Реакции[?]
428
Поинты[?]
96K
I understand that imgui is not thread safe at all but since i want to two different windows with immgui
C++:
void render_overlay() {
    static bool show_another_window;

    ImGui::Begin("window 1");
    ImGui::Text("howdy");
    ImGui::Checkbox("show another window", &show_another_window);
    ImGui::End();
   
    if (show_another_window) {
        ImGui::Begin("window 2");
        ImGui::Button("hi");
        ImGui::End();
    }
}
 
артём диджитал дизайнер
Участник
Статус
Оффлайн
Регистрация
10 Окт 2020
Сообщения
490
Реакции[?]
477
Поинты[?]
66K
C++:
void render_overlay() {
    static bool show_another_window;

    ImGui::Begin("window 1");
    ImGui::Text("howdy");
    ImGui::Checkbox("show another window", &show_another_window);
    ImGui::End();

    if (show_another_window) {
        ImGui::Begin("window 2");
        ImGui::Button("hi");
        ImGui::End();
    }
}
i suspect that he means not just rendering two windows, but creating two separate frames (NewFrame or smth) with their own draw-lists, IO's, DirectX device initializing and rendering ofc.
so, this is not what he's looking for. i think CO (conversation opener, idk how to say this xD) is capable of figuring out something like this on his own, judging from his write style, he's seems above of that level of knowledge)
 
Femboy Access
Эксперт
Статус
Оффлайн
Регистрация
11 Ноя 2020
Сообщения
1,330
Реакции[?]
428
Поинты[?]
96K
i suspect that he means not just rendering two windows, but creating two separate frames (NewFrame or smth) with their own draw-lists, IO's, DirectX device initializing and rendering ofc.
so, this is not what he's looking for. i think CO (conversation opener, idk how to say this xD) is capable of figuring out something like this on his own, judging from his write style, he's seems above of that level of knowledge)
Well, idk why he needs different threads for rendering. If he needs to gather data from other scopes he should make a function like esp::draw or smth and call it in the rendering hook
 
feel irl
Участник
Статус
Оффлайн
Регистрация
21 Дек 2018
Сообщения
677
Реакции[?]
294
Поинты[?]
16K
Последнее редактирование:
Разработчик
Статус
Оффлайн
Регистрация
1 Сен 2018
Сообщения
1,606
Реакции[?]
872
Поинты[?]
113K
дохуя пендосы собрались, а так imgui пока не поддерживает мультипоток без ебли
 
артём диджитал дизайнер
Участник
Статус
Оффлайн
Регистрация
10 Окт 2020
Сообщения
490
Реакции[?]
477
Поинты[?]
66K
Well, idk why he needs different threads for rendering. If he needs to gather data from other scopes he should make a function like esp::draw or smth and call it in the rendering hook
everyone has different needs and their own perception of how their program should look in code.
perhaps he wants to implement his own software in a different way.
everything has its own purpose, and what is easier to impl. is not always better.

let's not discuss such things as "race-condition" here, tc just need a solution (answer) on his problem (question)

ty xd
I think you're right. Is it possible using imgui? I guess no.
I'll agree. personally, idk of such a method.
perhaps in future, they will add such possibility, but I don't see much sense in such a huge update that would require to modify almost entire ImGui backend.

well, i think we're already answered to TC in this thread
 
Начинающий
Статус
Оффлайн
Регистрация
26 Июн 2022
Сообщения
10
Реакции[?]
4
Поинты[?]
4K
i suspect that he means not just rendering two windows, but creating two separate frames (NewFrame or smth) with their own draw-lists, IO's, DirectX device initializing and rendering ofc.
so, this is not what he's looking for. i think CO (conversation opener, idk how to say this xD) is capable of figuring out something like this on his own, judging from his write style, he's seems above of that level of knowledge)
yes sir im looking for 2 completely different rendering with new init and new frames.
Currently im stuck on the following:

When i start the second menu it inits imgui and DirectX11 just fine butmy main menu instantly dies saying "Did you forgot to call ImGui::NewFrame".
Note that i did not forgot to call it ofc and i call them in both menus.
everyone has different needs and their own perception of how their program should look in code.
perhaps he wants to implement his own software in a different way.
everything has its own purpose, and what is easier to impl. is not always better.

let's not discuss such things as "race-condition" here, tc just need a solution (answer) on his problem (question)


ty xd

I'll agree. personally, idk of such a method.
perhaps in future, they will add such possibility, but I don't see much sense in such a huge update that would require to modify almost entire ImGui backend.

well, i think we're already answered to TC in this thread
I read about it and there is a pull request that is aiming to do this but its ofc not finished. The owner of imgui said he is planning on implementing multithreading support but not on the short run and ofc i need it now not a year later XD.

here is the link
Пожалуйста, авторизуйтесь для просмотра ссылки.

Пожалуйста, авторизуйтесь для просмотра ссылки.
 
Начинающий
Статус
Оффлайн
Регистрация
26 Июн 2022
Сообщения
10
Реакции[?]
4
Поинты[?]
4K
nvm i did not manage to do it even with that imgui fork. Anyone any other idea?
Well, idk why he needs different threads for rendering. If he needs to gather data from other scopes he should make a function like esp::draw or smth and call it in the rendering hook
i want to draw to 2 different window at the same time. NOT IMGUI WINDOW 2 different application window with 2 different render and operations for imgui.
 
Сверху Снизу