[2.2] How to compile MyGUI for Ogre 2.2
-
- Gnome
- Posts: 388
- Joined: Mon Aug 06, 2007 12:53 pm
- Location: Saarland, Germany
- x 9
[2.2] How to compile MyGUI for Ogre 2.2
Hi together,
I wanted to ask, if someone already ported the MyGUI Engine to Ogre2.2?
I get a lot of erros in Ogre2Platform project, because textures and compositors api has of course changed.
Best Regards
Lax
I wanted to ask, if someone already ported the MyGUI Engine to Ogre2.2?
I get a lot of erros in Ogre2Platform project, because textures and compositors api has of course changed.
Best Regards
Lax
0 x
-
- OGRE Expert User
- Posts: 1075
- Joined: Sat Jul 06, 2013 10:59 pm
- Location: Chile
- x 92
Re: [2.2] How to compile MyGUI for Ogre 2.2
rujialiu I summon you!
he helped me with that task, and prefer if he shares it.
rujia, maybe you could make a branch/fork on the official myGui repo?
he helped me with that task, and prefer if he shares it.
rujia, maybe you could make a branch/fork on the official myGui repo?
0 x
-
- OGRE Expert User
- Posts: 1212
- Joined: Thu Dec 11, 2008 7:56 pm
- Location: Bristol, UK
- x 80
Re: [2.2] How to compile MyGUI for Ogre 2.2
Arggg. I was also helped by rujialiu, but I did say I would create a PR with my changes but have failed to do that. I am not sure my approach to the changes is the most universal, but maybe I should at least make them public. I ve put it off because it requires git, which just irritates me! Ill try and find time this weekend
0 x
-
- Gnome
- Posts: 388
- Joined: Mon Aug 06, 2007 12:53 pm
- Location: Saarland, Germany
- x 9
-
- Goblin
- Posts: 237
- Joined: Mon May 09, 2016 8:21 am
- x 24
Re: [2.2] How to compile MyGUI for Ogre 2.2
haha, I was too lazy and hoped that al2950 would find sometime to publish the changes earlier than I do...
That would be very nice. Even if your changes are not most universal, it must be better than what I originally sent youArggg. I was also helped by rujialiu, but I did say I would create a PR with my changes but have failed to do that. I am not sure my approach to the changes is the most universal, but maybe I should at least make them public. I ve put it off because it requires git, which just irritates me! Ill try and find time this weekend

0 x
-
- OGRE Expert User
- Posts: 1212
- Joined: Thu Dec 11, 2008 7:56 pm
- Location: Bristol, UK
- x 80
Re: [2.2] How to compile MyGUI for Ogre 2.2
Sorry, failed to do this last weekend. I will try Friday. Please just keep pestering me!
1 x
-
- Gnome
- Posts: 388
- Joined: Mon Aug 06, 2007 12:53 pm
- Location: Saarland, Germany
- x 9
Re: [2.2] How to compile MyGUI for Ogre 2.2
Hi al2950,
you asked to pestering you
Is there any progress?
Best regards
Lax
you asked to pestering you

Is there any progress?
Best regards
Lax
0 x
-
- OGRE Expert User
- Posts: 1212
- Joined: Thu Dec 11, 2008 7:56 pm
- Location: Bristol, UK
- x 80
Re: [2.2] How to compile MyGUI for Ogre 2.2
ok, so it turns out I was even lazier than I thought. I think i took rujialiu changes and made them less sensible! I would really like to sort this properly so there is 1 ogre branch in mygui, with as much shared code as possible. This will obviously take a little while, and might be too messy to actually do. in the meantime I have uploaded what I currently use for 2.2:
https://github.com/al2950/mygui/tree/Ogre2.2
https://github.com/al2950/mygui/tree/Ogre2.2
3 x
-
- Gnome
- Posts: 388
- Joined: Mon Aug 06, 2007 12:53 pm
- Location: Saarland, Germany
- x 9
-
- Goblin
- Posts: 237
- Joined: Mon May 09, 2016 8:21 am
- x 24
Re: [2.2] How to compile MyGUI for Ogre 2.2
yeah!!!al2950 wrote: ↑Sun May 26, 2019 11:52 amok, so it turns out I was even lazier than I thought. I think i took rujialiu changes and made them less sensible! I would really like to sort this properly so there is 1 ogre branch in mygui, with as much shared code as possible. This will obviously take a little while, and might be too messy to actually do. in the meantime I have uploaded what I currently use for 2.2:
https://github.com/al2950/mygui/tree/Ogre2.2
0 x
-
- OGRE Expert User
- Posts: 1075
- Joined: Sat Jul 06, 2013 10:59 pm
- Location: Chile
- x 92
Re: [2.2] How to compile MyGUI for Ogre 2.2
Hello! I have MyGui working with Ogre 2.2 and OpenGL... the main usage for my is to render gui in to a texture that I use on some object inside the 3D scene.
Now I am porting my engine to Direct3D11 and all the MyGui stuffs don't show on the objects on the scene but it shows on the main render window :S
I am giving the correct texture when I call addWorkspace, and checked that the workspace has indeed the correct texture when update is being called. Also checked on renderdoc that the correct texture is not being filled with the gui image.
anyone else is using MyGui to render in to an Ogre 2.2 texture?
thanks!
Now I am porting my engine to Direct3D11 and all the MyGui stuffs don't show on the objects on the scene but it shows on the main render window :S
I am giving the correct texture when I call addWorkspace, and checked that the workspace has indeed the correct texture when update is being called. Also checked on renderdoc that the correct texture is not being filled with the gui image.
anyone else is using MyGui to render in to an Ogre 2.2 texture?
thanks!
0 x
-
- OGRE Expert User
- Posts: 1075
- Joined: Sat Jul 06, 2013 10:59 pm
- Location: Chile
- x 92
Re: [2.2] How to compile MyGUI for Ogre 2.2
solved this problem thanks to dark_sylinc, by changing MyGUIPass::execute to this:
Code: Select all
void MyGUIPass::execute(const Ogre::Camera *lodCameraconst)
{
profilingBegin();
executeResourceTransitions();
setRenderPassDescToCurrent();
static_cast<MyGUI::Ogre2RenderManager*>(MyGUI::RenderManager::getInstancePtr())->render();
profilingEnd();
}
thanks!
0 x
- dark_sylinc
- OGRE Team Member
- Posts: 4147
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 269
- Contact:
Re: [2.2] How to compile MyGUI for Ogre 2.2
The order of executeResourceTransitions and setRenderPassDescToCurrent was inverted!
setRenderPassDescToCurrent must be called first!
executeResourceTransitions is only relevant for Metal.
setRenderPassDescToCurrent must be called first!
executeResourceTransitions is only relevant for Metal.
0 x
-
- Goblin
- Posts: 237
- Joined: Mon May 09, 2016 8:21 am
- x 24
Re: [2.2] How to compile MyGUI for Ogre 2.2
A gentle reminder: the latest commit breaks a few API. In order to compile MyGUI, you need a simple change:
The line might not match because I'm using my own MyGUI branch.
Code: Select all
Platforms/Ogre2/Ogre2Platform/src/MyGUI_Ogre2RTTexture.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Platforms/Ogre2/Ogre2Platform/src/MyGUI_Ogre2RTTexture.cpp b/Platforms/Ogre2/Ogre2Platform/src/MyGUI_Ogre2RTTexture.cpp
index 72a57b5..a32177d 100644
--- a/Platforms/Ogre2/Ogre2Platform/src/MyGUI_Ogre2RTTexture.cpp
+++ b/Platforms/Ogre2/Ogre2Platform/src/MyGUI_Ogre2RTTexture.cpp
@@ -100,7 +100,7 @@ namespace MyGUI
//mSaveRenderPassDesc = system->getCurrentPassDescriptor();
Ogre::Vector4 viewportSize(0, 0, 1, 1);
Ogre::Vector4 scissors(0, 0, 1, 1);
- system->beginRenderPassDescriptor(mRenderPassDesc, mTexture, 0, viewportSize, scissors, false, false);
+ system->beginRenderPassDescriptor(mRenderPassDesc, mTexture, 0, &viewportSize, &scissors, 1, false, false);
#endif
}
0 x
-
- Gnome
- Posts: 388
- Joined: Mon Aug 06, 2007 12:53 pm
- Location: Saarland, Germany
- x 9
Re: [2.2] How to compile MyGUI for Ogre 2.2
Hi all,
was someone able to adapt MyGUI to newest Ogre2.2 version from github?
Now some includes cannot be found anymore:
They have been moved to "deprecated" folder. When this folder is prefixed, other errors do occur.
Another question, what happened to RenderWindow? It is no more available...
Best Regards
Lax
was someone able to adapt MyGUI to newest Ogre2.2 version from github?
Now some includes cannot be found anymore:
Code: Select all
#include <OgreTextureManager.h>
#include <OgreTexture.h>
#include <OgrePixelBox.h>
...
Another question, what happened to RenderWindow? It is no more available...
Best Regards
Lax
0 x
- dark_sylinc
- OGRE Team Member
- Posts: 4147
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 269
- Contact:
Re: [2.2] How to compile MyGUI for Ogre 2.2
Hi!
This was all deadcode, so if the code was fully running on Ogre 2.2 it is very likely that just removing those includes is enough to make things running again.
If for some reason that's not the case, then the header files are still included on the Deprecated folder and add that folder to the list of include_headers so that they can be found by the compiler
This was all deadcode, so if the code was fully running on Ogre 2.2 it is very likely that just removing those includes is enough to make things running again.
If for some reason that's not the case, then the header files are still included on the Deprecated folder and add that folder to the list of include_headers so that they can be found by the compiler
0 x
-
- Gnome
- Posts: 388
- Joined: Mon Aug 06, 2007 12:53 pm
- Location: Saarland, Germany
- x 9
Re: [2.2] How to compile MyGUI for Ogre 2.2
Hi,
I could replace "OgreTextureManager" with "OgreTextureGpuManager" etc.
Trying to compile MyGUI I found other issues:
- Ogre::TextureUsage is also no more available:
How could that be replaced?
Unfortunately not.This was all deadcode, so if the code was fully running on Ogre 2.2 it is very likely that just removing those includes is enough to make things running again.
I could replace "OgreTextureManager" with "OgreTextureGpuManager" etc.
Trying to compile MyGUI I found other issues:
- Ogre::TextureUsage is also no more available:
Code: Select all
Ogre::TextureUsage Ogre2Texture::convertUsage(TextureUsage _usage)
{
if (_usage == TextureUsage::Default)
{
return Ogre::TU_STATIC_WRITE_ONLY;
}
else if (_usage == TextureUsage::RenderTarget)
{
return Ogre::TU_RENDERTARGET;
}
else if (_usage.isValue(TextureUsage::Static))
{
if (_usage.isValue(TextureUsage::Write))
{
return Ogre::TU_STATIC_WRITE_ONLY;
}
else
{
return Ogre::TU_STATIC;
}
}
else if (_usage.isValue(TextureUsage::Dynamic))
{
if (_usage.isValue(TextureUsage::Write))
{
return Ogre::TU_DYNAMIC_WRITE_ONLY;
}
else
{
return Ogre::TU_DYNAMIC;
}
}
else if (_usage.isValue(TextureUsage::Stream))
{
if (_usage.isValue(TextureUsage::Write))
{
return Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE;
}
else
{
return Ogre::TU_DYNAMIC;
}
}
return Ogre::TU_DEFAULT;
}
0 x
-
- Goblin
- Posts: 237
- Joined: Mon May 09, 2016 8:21 am
- x 24
Re: [2.2] How to compile MyGUI for Ogre 2.2
That can be COMPLETELY removed. That function, and the mUsage member variable, because they're not used anyway. Only MyGUI's own usage (_usage) is used. When creating a manual texture, we can directly query _usage instead of mUsage.Lax wrote: ↑Tue Oct 08, 2019 9:20 pmHi,
Unfortunately not.This was all deadcode, so if the code was fully running on Ogre 2.2 it is very likely that just removing those includes is enough to make things running again.
I could replace "OgreTextureManager" with "OgreTextureGpuManager" etc.
Trying to compile MyGUI I found other issues:
- Ogre::TextureUsage is also no more available:How could that be replaced?Code: Select all
Ogre::TextureUsage Ogre2Texture::convertUsage(TextureUsage _usage) { if (_usage == TextureUsage::Default) { return Ogre::TU_STATIC_WRITE_ONLY; } else if (_usage == TextureUsage::RenderTarget) { return Ogre::TU_RENDERTARGET; } else if (_usage.isValue(TextureUsage::Static)) { if (_usage.isValue(TextureUsage::Write)) { return Ogre::TU_STATIC_WRITE_ONLY; } else { return Ogre::TU_STATIC; } } else if (_usage.isValue(TextureUsage::Dynamic)) { if (_usage.isValue(TextureUsage::Write)) { return Ogre::TU_DYNAMIC_WRITE_ONLY; } else { return Ogre::TU_DYNAMIC; } } else if (_usage.isValue(TextureUsage::Stream)) { if (_usage.isValue(TextureUsage::Write)) { return Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE; } else { return Ogre::TU_DYNAMIC; } } return Ogre::TU_DEFAULT; }
In case your MyGUI code used it (I'm using my own branch so it's possible that your MyGUI branch is still using it), here is my createManual function:
Code: Select all
void Ogre2Texture::createManual(int _width, int _height, TextureUsage _usage, PixelFormat _format)
{
setFormat(_format);
setUsage(_usage);
uint32 textureFlags = 0; // Ogre::TextureFlags::PrefersLoadingFromFileAsSRGB
if (_usage.isValue(TextureUsage::RenderTarget)) {
textureFlags |= Ogre::TextureFlags::RenderToTexture;
}
// TODO: Ogre::TextureFlags::Manual
Ogre::TextureGpuManager *textureMgr = Ogre::Root::getSingletonPtr()->getRenderSystem()->getTextureGpuManager();
mTexture = textureMgr->createOrRetrieveTexture(
mName,
Ogre::GpuPageOutStrategy::Discard,
textureFlags,
Ogre::TextureTypes::Type2D,
Ogre::ResourceGroupManager::
AUTODETECT_RESOURCE_GROUP_NAME);
if (mTexture) {
mTexture->setResolution(_width, _height);
mTexture->setPixelFormat(mPixelFormat);
}
if (_usage.isValue(TextureUsage::RenderTarget)) {
textureFlags |= Ogre::TextureFlags::RenderToTexture;
if (mTexture->getNextResidencyStatus() != Ogre::GpuResidency::Resident) {
mTexture->_transitionTo(Ogre::GpuResidency::Resident, nullptr);
mTexture->_setNextResidencyStatus(Ogre::GpuResidency::Resident);
}
}
setDataBlockTexture(mTexture);
}
2 x
-
- Goblin
- Posts: 237
- Joined: Mon May 09, 2016 8:21 am
- x 24
Re: [2.2] How to compile MyGUI for Ogre 2.2
But... if you already updated to the latest commit or latest this one: https://github.com/OGRECave/ogre-next/c ... f3d539bc48
After your code compiles, it's likely that it'll crash. That's because the with fixing issue 33, RenderQueue::frameEnded() has an assertion inside that expect every render() is followed by renderPassPrepare() AND no VaoManager::_update() is called in-between(). However, that means in MyGUI's Ogre2RenderManager::render(), you have to call renderPassPrepare before calling render(), like this:
Code: Select all
mSceneManager->getRenderQueue()->renderPassPrepare(false, false);
mSceneManager->getRenderQueue()->render(mSceneManager->getDestinationRenderSystem(), RENDER_QUEUE_OVERLAY, RENDER_QUEUE_OVERLAY+1, false, false);
1 x
-
- Gnome
- Posts: 388
- Joined: Mon Aug 06, 2007 12:53 pm
- Location: Saarland, Germany
- x 9
- dark_sylinc
- OGRE Team Member
- Posts: 4147
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 269
- Contact:
Re: [2.2] How to compile MyGUI for Ogre 2.2
I took a detailed look: it looks like the assert accidentally caught a bad use. It's not a bug.rujialiu wrote: ↑Wed Oct 09, 2019 2:41 amAfter your code compiles, it's likely that it'll crash. That's because the with fixing issue 33, RenderQueue::frameEnded() has an assertion inside that expect every render() is followed by renderPassPrepare() AND no VaoManager::_update() is called in-between(). However, that means in MyGUI's Ogre2RenderManager::render(), you have to call renderPassPrepare before calling render(), like this:
That is likely breaking other codes as well. Is it intended, @dark_sylinc?Code: Select all
mSceneManager->getRenderQueue()->renderPassPrepare(false, false); mSceneManager->getRenderQueue()->render(mSceneManager->getDestinationRenderSystem(), RENDER_QUEUE_OVERLAY, RENDER_QUEUE_OVERLAY+1, false, false);
The function RenderQueue::renderPassPrepare must be called if you're calling RenderQueue::render.
In Ogre 2.1 the tasks performed by renderPassPrepare were being done inside RenderQueue::render.
IIRC we had to split them into two functions because of some Metal incompatibility with RenderPassDescriptors. Overlays were being naughty in their _updateRenderQueue calls (a v1 legacy stuff), and were forcing to breakup the close a RenderCommandEncoder too early in order to open a BlitCommandEncoder, so we had to move things around.
And thus we had to move things around. The current order of execution which must be honoured to work correctly in Metal:
- Call RenderSystem::beginRenderPassDescriptor
- Call Overlays' _updateRenderQueue (i.e. in fireRenderQueueStarted). You don't need to if you don't use Overlays. But if you need to copy GPU buffers around, then this still applies.
- Call RenderQueue::renderPassPrepare
- Call executeRenderPassDescriptorDelayedActions (which originally was inside beginRenderPassDescriptor)
- Call RenderQueue::render
Cheers
Update: I've pushed a documentation update to clarify this
1 x
-
- Goblin
- Posts: 237
- Joined: Mon May 09, 2016 8:21 am
- x 24
Re: [2.2] How to compile MyGUI for Ogre 2.2
Oh, thanks! So the MyGUI code should also call renderPassPrepare BEFORE you wrote the assertions. I guess everyone here, like me, don't use MyGUI in Metal RSdark_sylinc wrote: ↑Sun Oct 20, 2019 11:50 pmUpdate: I've pushed a documentation update to clarify this

0 x