MyGUI ported to Ogre 2.1! =)

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
User avatar
Daixiwen
Greenskin
Posts: 104
Joined: Fri Feb 08, 2013 11:30 am
Location: Oslo
x 1

Re: MyGUI ported to Ogre 2.1! =)

Post by Daixiwen » Sun Aug 16, 2015 9:39 pm

Sorry for the lack of feedback but I did manage to get everything to compile with no errors. I'm now using Visual Studio 2013 x64 on Windows 10.

I'm using Ogre commit 99effb28b8ec (2015-08-12 18:55:16 -0300) and MyGui commit f63f0156724b (2015-08-11 14:30:08 +0300).

As I said before I had trouble running the samples, having random crashes at startup. I managed to find the problem. It's a bug in Ogre but I think MyGui could have an extra error log or an assertion fail.
The problem is when installing the custom compositor pass provider.
This fragment is from MyGui's OgreRenderManager::initialise function:

Code: Select all

		Ogre::CompositorManager2* pCompositorManager = Ogre::Root::getSingleton().getCompositorManager2();
		// don't overwrite a custom pass provider that the user may have registered already
		if (!pCompositorManager->getCompositorPassProvider())
			pCompositorManager->setCompositorPassProvider(mPassProvider.get());
It's a good idea to check that there isn't already a pass provider, but if MyGui's provider is not installed, shouldn't there at least be an error message in the log? Without it if someone tries to initialize MyGui while having already installed a custom pass (or used another library that also uses custom passes) then that person can have a hard time finding out why MyGui isn't showing anything.

Now for the bug... it turns out that Ogre doesn't initialize the pass provider variable. In my case that variable was most of the time containing grabage. So MyGui didn't install its custom pass provider, and later when MyGui tried to install the custom pass, Ogre crashed while trying to call the pas provider. Simply adding this line in Ogre's CompositorManager2 fixed the problem:

Code: Select all

    CompositorManager2::CompositorManager2( RenderSystem *renderSystem ) :
        mFrameCount( 0 ),
        mRenderSystem( renderSystem ),
        mSharedTriangleFS( 0 ),
        mSharedQuadFS( 0 ),
        mDummyObjectMemoryManager( 0 ),
        mCompositorPassProvider(0)   // <<<<<<<<
    {
If necessary I can create a pull request, I just have to create a clone of Ogre's repository and find out how to do it from Bitbucket's site ;)
0 x
Hardware, n.: part of the computer you can kick

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4036
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 214
Contact:

Re: MyGUI ported to Ogre 2.1! =)

Post by dark_sylinc » Sun Aug 16, 2015 10:27 pm

Daixiwen wrote:Now for the bug... it turns out that Ogre doesn't initialize the pass provider variable. In my case that variable was most of the time containing grabage. So MyGui didn't install its custom pass provider, and later when MyGui tried to install the custom pass, Ogre crashed while trying to call the pas provider. Simply adding this line in Ogre's CompositorManager2 fixed the problem
Fixed. Thanks.
0 x

al2950
OGRE Expert User
OGRE Expert User
Posts: 1196
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 76

Re: MyGUI ported to Ogre 2.1! =)

Post by al2950 » Mon Aug 17, 2015 6:53 pm

Daixiwen wrote: It's a good idea to check that there isn't already a pass provider, but if MyGui's provider is not installed, shouldn't there at least be an error message in the log? Without it if someone tries to initialize MyGui while having already installed a custom pass (or used another library that also uses custom passes) then that person can have a hard time finding out why MyGui isn't showing anything.
Agreed, I will make the change. Glad you got it working :)
0 x

al2950
OGRE Expert User
OGRE Expert User
Posts: 1196
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 76

Re: MyGUI ported to Ogre 2.1! =)

Post by al2950 » Mon Aug 17, 2015 8:16 pm

al2950 wrote:
Daixiwen wrote: It's a good idea to check that there isn't already a pass provider, but if MyGui's provider is not installed, shouldn't there at least be an error message in the log? Without it if someone tries to initialize MyGui while having already installed a custom pass (or used another library that also uses custom passes) then that person can have a hard time finding out why MyGui isn't showing anything.
Agreed, I will make the change. Glad you got it working :)
done
0 x

User avatar
Daixiwen
Greenskin
Posts: 104
Joined: Fri Feb 08, 2013 11:30 am
Location: Oslo
x 1

Re: MyGUI ported to Ogre 2.1! =)

Post by Daixiwen » Tue Aug 18, 2015 6:57 am

Great! thanks guys, that was quick!
0 x
Hardware, n.: part of the computer you can kick

User avatar
Thyrion
Goblin
Posts: 224
Joined: Wed Jul 31, 2013 1:58 pm
Location: germany

Re: MyGUI ported to Ogre 2.1! =)

Post by Thyrion » Wed Aug 26, 2015 10:33 am

just looked at the 2.1 port.

and i've found this:
Ogre::v1::HardwareBufferManager

shouldn't we use the vaomanager in 2.1? :|
0 x

al2950
OGRE Expert User
OGRE Expert User
Posts: 1196
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 76

Re: MyGUI ported to Ogre 2.1! =)

Post by al2950 » Wed Aug 26, 2015 11:39 am

Thyrion wrote:just looked at the 2.1 port.

and i've found this:
Ogre::v1::HardwareBufferManager

shouldn't we use the vaomanager in 2.1? :|
In short yes... I did not do that part, but it would not be too difficult to update to a 'V2 object'. I believe it was done as that was better understood by the team who converted it. It is in my list of TODO's, but its pretty far down the list, and the list is large!!
0 x

aymar
Greenskin
Posts: 145
Joined: Fri Jun 12, 2015 6:53 pm
Location: Florianopolis, Brazil

Re: MyGUI ported to Ogre 2.1! =)

Post by aymar » Mon Aug 31, 2015 1:19 pm

Hey guys, can you help me?

I have a machine running with an older clone of Ogre2.1 and with MyGUI 2.1 from dotWolff fork, and this one works, the GUI renders, etc.

But recently I cloned the latest Ogre2.1 repo in another machine and got MyGUI 2.1 from its master repo. It compiled, but the GUI isn't rendering. And I'm not getting any log related to this.

Is there any additional setup I need to do compared to the DotWolff's version of Ogre2Platform?

Am I forgetting anything?

What I'm doing is: I register the Unlit Hlms, then I initialize MyGUI's Ogre2latform, then I setup the Ogre's default workspace, and the GUI isn't appearing.

Thanks.
0 x

al2950
OGRE Expert User
OGRE Expert User
Posts: 1196
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 76

Re: MyGUI ported to Ogre 2.1! =)

Post by al2950 » Mon Aug 31, 2015 1:27 pm

The latest version of the MyGui port has its own compositor pass, so you need to either add a mygui pass into your workspace like this;

Code: Select all

compositor_node Example
{
    in 0 inputRtt
...

    target inputRtt
    {
        pass custom MYGUI
        {
        }
    }
}
Or you could set it up in code, this is what the MyGui samples do
https://github.com/MyGUI/mygui/blob/ogr ... r.cpp#L232

Please note that MyGui adds a custom pass provider, but if you have your own custom pass provider than you will have to make sure it generates the MyGui pass. There will be a warning in the log if this happens.
0 x

aymar
Greenskin
Posts: 145
Joined: Fri Jun 12, 2015 6:53 pm
Location: Florianopolis, Brazil

Re: MyGUI ported to Ogre 2.1! =)

Post by aymar » Mon Aug 31, 2015 3:40 pm

Yup, that did it! Thanks a lot.
0 x

Ivancho
Gnoblar
Posts: 5
Joined: Wed Jan 07, 2009 11:18 pm

Re: MyGUI ported to Ogre 2.1! =)

Post by Ivancho » Mon Oct 12, 2015 2:11 pm

Hi, im sorry, but adding compositor pass did nothing for me. :oops:
Ogre give me error "Compiler error: invalid parameters in Compositor.material(4)"
maybe i do something wrong?

Code: Select all

compositor_node Render {
	in 0 renderWindow
	texture rt0 target_width target_height PF_R8G8B8
	target renderWindow	{
		pass clear{
			colour_value 0.1 0.1 0.1 1
		}
		pass render_quad {
	    	material Test
	    	input 0 rt0
	    }
	    pass render_scene{}
	    pass custom MyGUI{}
	}
}
workspace MainWorkspace {
	connect_output Render 0
}
0 x

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4036
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 214
Contact:

Re: MyGUI ported to Ogre 2.1! =)

Post by dark_sylinc » Mon Oct 12, 2015 3:09 pm

My first guess is the lack of space between render_scene and the '{}' could be giving the parser issues (same with clear, same with MyGUI & {})
My second guess is MyGUI != MYGUI.

The log is telling you the line where the error is (line 4), but I'm not sure if you pasted the whole source to the file or not.

First try to get the syntax similar to what the examples show you, then suit it to your own style preferences until you find whatever is causing the issue.
0 x

Ivancho
Gnoblar
Posts: 5
Joined: Wed Jan 07, 2009 11:18 pm

Re: MyGUI ported to Ogre 2.1! =)

Post by Ivancho » Mon Oct 12, 2015 7:46 pm

Big thanks, i fail with MYGUI string. :oops:
Also my fail is: loading resources before MyGUI initialization (compositor),
when i change to this code, its works.

Code: Select all

        // Load all resources except compositor
	ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
	
	// Init MyGUI
	mUIPlatform = new MyGUI::Ogre2Platform();
	mUIPlatform->initialise(mWindow, sceneMgr, Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);	
	mGui = new MyGUI::Gui();
	mGui->initialise();	
	
	// Load compositor resources
	ResourceGroupManager::getSingleton().addResourceLocation("resources\\Compositor", "FileSystem", "Compositors");
	ResourceGroupManager::getSingleton().initialiseResourceGroup("Compositors");
However, resources parser work fine with strings like this:

Code: Select all

pass render_scene {}
Thanks again :D
0 x

Lax
Gnome
Posts: 367
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 8

Re: MyGUI ported to Ogre 2.1! =)

Post by Lax » Mon Apr 03, 2017 9:52 pm

Hello,

I'm trying to get MyGui with Ogre2.1 working, but It failes, because:

MyGUI::OgreCompositorPassProvider::mPassId

is not recognized. When I use a custom string, I get an exception, that there is no pass provider.
This method is also no more recognized by Ogre2.1:

Code: Select all

workDef->connectOutput(nodeDef->getName(), 0);
Has anyone a valid code snipped how to init MyGui properly?

Regards
Lax
0 x

rujialiu
Goblin
Posts: 214
Joined: Mon May 09, 2016 8:21 am
x 20

Re: MyGUI ported to Ogre 2.1! =)

Post by rujialiu » Tue Apr 04, 2017 9:26 am

Lax wrote:Hello,

I'm trying to get MyGui with Ogre2.1 working, but It failes, because:

MyGUI::OgreCompositorPassProvider::mPassId

is not recognized. When I use a custom string, I get an exception, that there is no pass provider.
This method is also no more recognized by Ogre2.1:

Code: Select all

workDef->connectOutput(nodeDef->getName(), 0);
Has anyone a valid code snipped how to init MyGui properly?

Regards
Lax
I don't have snippet for now, but it's as simple as using its pass provider directly, or initialize a MyGUIPass from your own pass provider and call mygui pass's execute() inside your custom pass.

Also, please make sure:
1. you're using ogre2.1 branch of MyGUI
2. you're using Ogre2Platform instead of OgrePlatform

BTW: If you updated your Ogre to the latest commit, which contains the new shadow system, you need to modify MyGUI, (the constructor of PassDef and PassProvider has changed a bit), but it's trivial.
0 x

Lax
Gnome
Posts: 367
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 8

Re: MyGUI ported to Ogre 2.1! =)

Post by Lax » Wed Apr 05, 2017 7:04 pm

Hm, ok If you know how it works its simple yes, but really have no clue how to accomplish that. I'm just using MyGui as a blackbox and have no Idea how to adapt that. I tried several things.

Regards
Lax
0 x

al2950
OGRE Expert User
OGRE Expert User
Posts: 1196
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 76

Re: MyGUI ported to Ogre 2.1! =)

Post by al2950 » Wed Apr 05, 2017 8:54 pm

I have just updated mygui to compile on the latest 2.1. I shall upload tomorrow but can't guarantee it will work as expected as I just need it to compile! If you do have any issues post here and I will try and help.
0 x

Lax
Gnome
Posts: 367
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 8

Re: MyGUI ported to Ogre 2.1! =)

Post by Lax » Wed Apr 05, 2017 9:37 pm

If you do have any issues post here and I will try and help.
Ok thanks a lot.
0 x

al2950
OGRE Expert User
OGRE Expert User
Posts: 1196
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 76

Re: MyGUI ported to Ogre 2.1! =)

Post by al2950 » Thu Apr 06, 2017 5:45 pm

I have updated my fork here;
https://github.com/al2950/mygui/tree/ogre2.1

however I thought I would just check it actually still works and its not currently display anything. (Could just be a bug in my engine). Anyway I have not created a pull request yet until I have had time to look at the issue. Feel free to grab it yourself and try!
0 x

al2950
OGRE Expert User
OGRE Expert User
Posts: 1196
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 76

Re: MyGUI ported to Ogre 2.1! =)

Post by al2950 » Fri Apr 07, 2017 11:16 am

I have run some checks and it was indeed an issue with my resources in my engine. I have created a pull request;
https://github.com/MyGUI/mygui/pull/126
0 x

Lax
Gnome
Posts: 367
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 8

Re: MyGUI ported to Ogre 2.1! =)

Post by Lax » Mon Apr 10, 2017 1:21 pm

I'm trying to compile the newst MyGui Ogre2Plattform but getting compile errors:

Code: Select all

Ogre::CompositorPassDef(Ogre::PASS_CUSTOM, parentTargetDef)
It seems that "parentTargetDef" cannot be used for CompositorPassDef constructor. The CompositorPassDef constructor requires "uint32 rtIndex".
I also tried to use Ogre2.1 with 'shadows-refactor' branch, but got tons of errors when trying to compile MyGui Ogre2Plattform, so I went back to just Ogre2.1.

Which version do you use?

Regards
Lax
0 x

al2950
OGRE Expert User
OGRE Expert User
Posts: 1196
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 76

Re: MyGUI ported to Ogre 2.1! =)

Post by al2950 » Mon Apr 10, 2017 1:31 pm

See the commit message, I build it against the latest 2.1 at the time, ie;
8110feaf04d591d53aa8bf298fa480585d57d8a0

It am pretty I did everything from a clean build and clean cmake, but I could of made a mistake. If you still have issues please let me know. The latest versions of Ogre definitely require a targetDef not an index.
0 x

Lax
Gnome
Posts: 367
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 8

Re: MyGUI ported to Ogre 2.1! =)

Post by Lax » Mon Apr 10, 2017 9:40 pm

Hi al2950,

thanks for your advice, I got at least Ogre2Plattform compiled with Ogre2.1 shadow-refactor. It seems that something was wrong with the ogre project.
So now to the next issue. With Ogre2.1 shadow-refactor branch, the hlms init does not work anymore and there are no sample how to init now. I got errors when trying to register like in all samples:

Code: Select all

Ogre::HlmsUnlit* hlmsUnlit = OGRE_NEW Ogre::HlmsUnlit(archiveUnlit, &library);
Ogre::Root::getSingletonPtr()->getHlmsManager()->registerHlms(hlmsUnlit);

Ogre::Archive* archivePbs = Ogre::ArchiveManager::getSingletonPtr()->load(dataFolder + "Hlms/Pbs/" + shaderSyntax, "FileSystem", true);

Ogre::HlmsPbs* hlmsPbs = OGRE_NEW Ogre::HlmsPbs(archivePbs, &library);
Ogre::Root::getSingletonPtr()->getHlmsManager()->registerHlms(hlmsPbs);
The function 'registerHlms' can now only be called for pure hlms pointer...
0 x

al2950
OGRE Expert User
OGRE Expert User
Posts: 1196
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 76

Re: MyGUI ported to Ogre 2.1! =)

Post by al2950 » Tue Apr 11, 2017 8:58 am

@lax

I am assuming you are talking about your own app instead of MyGUI samples? Also could you give us the error so we can have a better idea on how to help. The hlms registering process has got a little more involved as there are more shared directories that need to be added.See ogre sample
0 x

Lax
Gnome
Posts: 367
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 8

Re: MyGUI ported to Ogre 2.1! =)

Post by Lax » Tue Apr 11, 2017 9:02 pm

Nevermind, I think my compiler showed some wrong messages, because the compiler was somewhat confused and so was I :D .
0 x

Post Reply