A few days ago I saw your post, searched for ImGUI and was surprised that I haven't seen it earlier.
So I immediately started trying to port it to Ogre 2.1 since that's what I'm currently porting.
First of all, your code was very legible and easy to understand, without it I don't even know if I would have even tried writing my own binding
But unfortunately some things didn't work under Ogre 2.1
So first I tried doing everything the correct "v2 way" - which was way too complicated.
Using vao's and creating a movable object and renderables didn't work out for me (at least in the
short amout of time I spent on it)
(BTW, there is a bug in your GLSL shader where you output "ocol" in the vertexshader but try to input "col" in the fragmentshader)
One of the issues render queue listeners: only renderQueueStarted is called (for the Ogre overlays to work),
so the listeners are basically useless
Then I had to modify the setting of the used Pass to use a hlms macro- and blendblock.
Also the correct blend mode was ignored by the render system, so I had to set it manually.
I'm not exactly sure how much I changed in the end, but I suspect your version and my 2.1 port differ to much to bundle it into one repro (also I changed some things to my own coding style
)
Sooo.... I'll just show my own version
https://bitbucket.org/ChaosCreator/imgu ... inding/src
Usage
Just init ImguiManager once after you init Ogre:
Code: Select all
ImguiManager::getSingleton().init(mSceneManager);
... and that's about it.
No need to include anything else (besides the 4 source files)
Don't call Imgui::newFrame() or Imgui::render() or something similar, the ImguiManager does it for you.
Also be aware that it just renders the GUI in the middle of frameRenderingQueued.
Besides that: you can now call all your Imgui functions and the results are immediately shown.
Input
Nearly forgot to say...
You have to do that part yourself (at least for now)
I removed the OIS part as I'm using SDL. SDL has no listeners, so I see no point of handling input in the ImguiManager itself.
Basically you need to update the Imgui key- and mousestate within your own code, but that is completely unrelated to ogre.
And after all, the gui should also be seperated from the input system of your choise
@Crashy
I also use the Imgui clipping data to set the scissoring tests accordingly
You might look into that, but it means splitting the Renderables much more finely since clipping is performed on every Gui element