[2.1] ImGui finally working for me

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


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

[2.1] ImGui finally working for me

Post by Slicky »

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

Here is the link to the repository: Repository
Last edited by Slicky on Fri May 22, 2020 8:31 am, edited 2 times in total.
chchwy
Kobold
Posts: 30
Joined: Fri Feb 10, 2017 1:40 am
x 11

Re: [2.1] ImGui finally working for me

Post by chchwy »

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?
Slicky
Bronze Sponsor
Bronze Sponsor
Posts: 614
Joined: Mon Apr 14, 2003 11:48 pm
Location: Was LA now France
x 25

Re: [2.1] ImGui finally working for me

Post by Slicky »

Hi there

Here is my working version for Ogre 2.1

Bitbucket repository
User avatar
Ybalrid
Halfling
Posts: 89
Joined: Thu Jul 10, 2014 6:52 pm
Location: France
x 31
Contact:

Re: [2.1] ImGui finally working for me

Post by Ybalrid »

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

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/
User avatar
Zonder
Ogre Magi
Posts: 1168
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 73

Re: [2.1] ImGui finally working for me

Post by Zonder »

Slicky wrote: Thu Oct 25, 2018 9:52 am Hi there

Here is my working version for Ogre 2.1

Bitbucket repository
Just realised you prob should update your first post with this information ;)
There are 10 types of people in the world: Those who understand binary, and those who don't...
Slicky
Bronze Sponsor
Bronze Sponsor
Posts: 614
Joined: Mon Apr 14, 2003 11:48 pm
Location: Was LA now France
x 25

Re: [2.1] ImGui finally working for me

Post by Slicky »

Ok did that - thanks for pointing it out.
Nucleartree
Kobold
Posts: 28
Joined: Tue Apr 04, 2017 9:10 pm
Location: Cardiff, UK
x 16

Re: [2.1] ImGui finally working for me

Post by Nucleartree »

Hi.

I'm not really sure how useful it is now, but my project, also based on 2.1, has an implementation of imgui.

https://gitlab.com/edherbert/southsea

It might help in future. I also have a version which works on macos with metal, and last time I tried that code it did work on D3D11 as well.

I hope to update it to 2.2 at some point, but that might be a while from now. Good job figuring it out either way!
Post Reply