[PORTED][2.1] MyGUI port

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


Post Reply
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

[PORTED][2.1] MyGUI port

Post by al2950 »

***EDIT*** MyGUI has now been ported to 2.1, for more info on the port see;
http://ogre3d.org/forums/viewtopic.php? ... 69#p518996



I have been looking at porting MyGui to 2.1, which I thought would be fairly simple however I wanted to go about it a certain way, which has proved difficult!

Basically what is currently does, which is the same as the CEGUI port, is call functions on render system directly. This includes creating render system specific shaders for renderers that dont support FFP. Anyway I did not really like this and thought it was unnecessary especially as one of the main points of Ogre is that it deals with these issues for you. So I went down the route of using the Unlit HLMS along with the _renderSingleObject command. The problem with this is that renderSingleObject only support V1_legacy mode, and so HLMS unlit can not be used for it.

This leaves me with a couple of options, and I would appreciate anyone's opinion as to which, if any, would be better.
  • - Go back to the orginal way of doing things and call the renderSystem directly, including creating specific shaders for MyGUI
  • - Add support of V2 objects in the _renderSingleObject command
  • - Create my own instance of RenderQueue inside MyGUI, add GUI renderables to it, and render.
  • - Change MyGUI completely, so instead of taking charge of the rendering it 'simply' adds renderables to a specified render queue. (NB This option is not easy and may not be possible without changing the MyGUI core)
Thanks in advance for any advice!
Last edited by al2950 on Wed Jul 22, 2015 9:30 pm, edited 1 time in total.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5588
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1413
Contact:

Re: [2.1] MyGUI port

Post by dark_sylinc »

al2950 wrote: [*] - Go back to the orginal way of doing things and call the renderSystem directly, including creating specific shaders for MyGUI
[*] - Create my own instance of RenderQueue inside MyGUI, add GUI renderables to it, and render.
The guy who's been porting CEGUI followed something among the lines of that route.
al2950 wrote:[*] - Add support of V2 objects in the _renderSingleObject command
I approve of this! (although will this actually solve your problem?)
User avatar
Jayray
Greenskin
Posts: 115
Joined: Sun Sep 09, 2012 5:29 pm
Location: Strasbourg, France
x 9

Re: [2.1] MyGUI port

Post by Jayray »

Yep, that's exactly what I have done :)

Here is the commit that shows all the changes I had to make for OpenGL3+.
And here is the second commit to make it work with D3D11.

To sum up, here is what I have done:
- Replace the old compositor by the new one (because CEGUI was not compatible with Ogre 2.0)
- Add the "v1" namespace where it was needed
- Rewrite the scissors test with the new API
- Use HLMS blocks (blendblock, macroblock and samplerblock) to set the render parameters to replace calls to functions like RenderSystem::_setSceneBlending
- Write a D3D11-compatible shader
- Use a dummy Ogre::HlmsCache object to bind the shaders to the render system

My first try also was to use the Unlit HLMS, but I think I was stuck at the same point as you...
At the time, I was really new to Ogre 2.1, so I had not even thought of making the _renderSingleObject command support the V2 objects :oops:
But now, I feel like this would indeed be the best solution, as it follows the Ogre 2.1 philosophy: let Ogre handle all the shader stuff and only use HLMS objects and only the V2 interface :)

The issue of what I have done for the CEGUI porting is that it will need to be changed when the v1 interfaces will be deleted. But for now, it works great :roll:
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: [2.1] MyGUI port

Post by al2950 »

Thanks for the info guys. I will have a look at updating _renderSingleObject.

I am not 100% sure of exactly how MyGui renders stuff, but it does seem to have a number of layers that it renders, and this is why I thought creating its own instance of renderQueue may be a good option as it could batch these layers into one 'Command'. Or is this a bad idea!?
User avatar
Daixiwen
Greenskin
Posts: 105
Joined: Fri Feb 08, 2013 11:30 am
Location: Oslo
x 16

Re: [2.1] MyGUI port

Post by Daixiwen »

How is the port going? I'm very interested in your results, because currently the only two things that prevent me from upgrading to Ogre 2.1 are MyGUI and ManualObject. For the latter I think I can get around it, but for the former I lack the knowledge to do the port myself.
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
x 8

Re: [2.1] MyGUI port

Post by Thyrion »

Daixiwen wrote: because currently the only two things that prevent me from upgrading to Ogre 2.1 are MyGUI and ManualObject. For the latter I think I can get around it, but for the former I lack the knowledge to do the port myself.
ManualObject is finally merged + added example:
https://bitbucket.org/sinbad/ogre/src/5 ... t/?at=v2-1
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: [2.1] MyGUI port

Post by al2950 »

Daixiwen wrote:How is the port going? I'm very interested in your results, because currently the only two things that prevent me from upgrading to Ogre 2.1 are MyGUI and ManualObject. For the latter I think I can get around it, but for the former I lack the knowledge to do the port myself.
Hi

I am currently having a bit of a busy period at work and so I have not done much more on it, furthermore any spare time I have has been taken by GTA V, not necessarily playing, but certainly staring at pretty graphics! :D .

I think I need a couple more days on it, and some patches for Ogre and as someone else is waiting on it I will try and make some time this weekend.
aymar
Greenskin
Posts: 145
Joined: Fri Jun 12, 2015 6:53 pm
Location: Florianopolis, Brazil
x 17

Re: [2.1] MyGUI port

Post by aymar »

Hey guys, we from 9heads Game Studios ported MyGUI to Ogre 2.1.

Here's the topic on that: http://www.ogre3d.org/forums/viewtopic.php?f=25&t=83569
Post Reply