[2.1] ImGui finally working for me

Design / architecture / roadmap discussions related to future of Ogre3D (version 2.0 and above)
Post Reply
Slicky
Bronze Sponsor
Bronze Sponsor
Posts: 536
Joined: Mon Apr 14, 2003 11:48 pm
Location: Was LA now France
x 11

[2.1] ImGui finally working for me

Post by Slicky » Wed Sep 26, 2018 9:06 am

After spending more time than I would like to admit I finally got ImGui working with Ogre 2.1. I have only tried GL3+ so far so would have to play with it more for DX11.

I tried everything I could find on the forums (including PSOHelper) and I just could not get it working. So what I ended up doing was reading the ImGui docs more thoroughly and decided to use his method. I was worried that since it wasn't using Ogre directly that it might not work. I downloaded the GLEW opengl helper library and used the methods used in the ImGui examples. I then integrated that into a copy of the Imguimanager posted here on the forums but mainly as a framework to get things going quicker. In my small testing I don't see any negatives as far as frame rate etc but we will see.

Image
2 x

chchwy
Gnoblar
Posts: 16
Joined: Fri Feb 10, 2017 1:40 am

Re: [2.1] ImGui finally working for me

Post by chchwy » Thu Oct 25, 2018 3:01 am

Hey Slicky. Thanks for sharing this.

I am also interested in integrating ImGui, could you share some of your sample code about how you did it?
0 x

Slicky
Bronze Sponsor
Bronze Sponsor
Posts: 536
Joined: Mon Apr 14, 2003 11:48 pm
Location: Was LA now France
x 11

Re: [2.1] ImGui finally working for me

Post by Slicky » Thu Oct 25, 2018 9:52 am

Hi there

Here is my working version for Ogre 2.1

Bitbucket repository
0 x

User avatar
Ybalrid
Halfling
Posts: 76
Joined: Thu Jul 10, 2014 6:52 pm
Location: France
x 21
Contact:

Re: [2.1] ImGui finally working for me

Post by Ybalrid » Sat Oct 27, 2018 6:20 pm

That's also what I am doing for a small level editor that I started working on. I'm using ImGui for the menues and a few floating windows, and ImGuizmo for having a thing to manipulate 3D objects. I'm using a GLFW window and GLEW to load OpenGL functions. The OpenGL context is created by GLFW and passed to Ogre via "["externalGLContext"] " on the option when manually creating the Ogre window object.

To get ImGui to render, I'm sticking to just use the OpenGL render system. I've put a call to all the ImGui draws inside a RenderTargetListener. Probably not the best idea of the world, but it does work.

Code: Select all


void Gui::ImGui_Ogre_RenderTargetListener::postRenderTargetUpdate(const Ogre::RenderTargetEvent& /*evt*/)
{
	ImGui::Render();
	ImGui_ImplGlfwGL3_RenderDrawData(ImGui::GetDrawData());
}

0 x
Ogre_glTF Ogre v2-1 GLTF2 loader : topic link github repo
BtOgre21 Fork of btOgre, for Ogre v2-1 : topic link github repo
OIS Current maintainer : Official repository
Annwvyn VR focused game engine using Ogre : https://github.com/Ybalrid/Annwvyn https://annwvyn.org/

Post Reply