Jump to content

Adding ImGui to Unigine


photo

Recommended Posts

Hello everyone,

I know Unigine already has built-in UI capabilities with the widgets, but I really enjoy using dear ImGui in my other projects, has anyone tried to write an implementation with Unigine ?

I tried to build one myself by copying the different implementations (The OpenGL3 and SDL ones) already provided on their git repo : https://github.com/ocornut/imgui/tree/master/backends but nothing I made works

Has anyone already tried an implementation or can give me some advices on the way to proceed ?

Link to comment

I do possess an engineering license, but how can I access directly the graphic API ? With the customApp class ?  I'm working on linux, meaning I'm using OpenGL instead of DirectX but I guess the procedure is pretty much the same.

How did you create an another directx window ?

Link to comment

Hello @devrom,

I looked at the sample Qt application integration, but it doesn't seem to fit my problem as I'm trying to include the UI in Unigine and not the other way around.

The Imgui implementation examples on their git repo are all based on APIs (SDL...) where you can directly access and control the main drawing loop, which is not the case in Unigine, so I don't really understand  how to use the OpenGL API to integrate anything in Unigine @a.octavian

Link to comment
On 1/19/2021 at 10:40 AM, Coppel.Damien said:

I looked at the sample Qt application integration, but it doesn't seem to fit my problem as I'm trying to include the UI in Unigine and not the other way around.

The approach is still very similar.

Quote

The Imgui implementation examples on their git repo are all based on APIs (SDL...) where you can directly access and control the main drawing loop, which is not the case in Unigine, so I don't really understand  how to use the OpenGL API to integrate anything in Unigine

1. You have to implement your own custom backend with ImGui. Look at the SDL backend for example. You need to do the same, but instead of using SDL functions you use Unigine. 
Example:

// SDL
g_ClipboardTextData = SDL_GetClipboardText();
//Unigine
g_ClipboardTextData = Unigine::App::getClipboard();

2. You do have control over the rendering loop if you use Unigine::CustomApp. You can override CustomApp::doRender() and call ImGui::Render() as well as your custom backend functions inside of it.

Link to comment
×
×
  • Create New...