Ogre 1.7

AticAtac

03-03-2010 15:02:32

Does mygui work with the new Ogre 1.7 ?

Altren

03-03-2010 15:04:35

Yes

AticAtac

03-03-2010 15:34:40

Any sample for how to use it in the sample generated with the 1.7 AppWizard ?
Are there any prebuilt SDK or do i have to download the sources (+dependencies) and build them myself?

Altren

03-03-2010 17:20:06

Try that ( http://www.ogre3d.org/wiki/index.php/MyGUI_quickstart ) and also try to play with MyGUI demos. I don't know what is generated with 1.7 AppWizard.
There is no SDK, you should download the sources (+dependencies) and build them yourself.

AticAtac

03-03-2010 18:20:49

Thx !

AticAtac

03-03-2010 20:48:27

I could compile and link MyGUI properly to my 1.7 Test App.
Now i've the problem that at runtime its missing core.xml.
Which files supposed to be in the path for MyGUI?
I place "resources.xml" in /bin which content point to MyGui-Media and MyGUI_Media.

Altren

03-03-2010 21:02:02

You need copy of MyGUI_Media folder and add path to it into your resources.cfg or whatever you use for Ogre paths. You don't need resources.xml - it is used by demos only.

AticAtac

03-03-2010 21:10:17

I added this:
FileSystem=../../MyGui/Media/MyGUI_Media
to resources_d.cfg in bin folder.
The above path is valid.
But still didn't work, gets an exception:
"OGRE_EXCEPTION(5:ItemIdentityException): Cannot locate a resource group called " for resource 'core.xml' in ResourceGroupManager::openResource at
..\..\..\..\OgreMain\src\OgreResourceGroupManager.cpp (line 685)

Altren

03-03-2010 21:14:32

If it is not in [General] resource group you should either move it there or add group name when initialising OgrePlatform

AticAtac

03-03-2010 21:21:32

Thx, it worked now.
(i forgot to call mPlatform->initialise(...) )

my.name

04-03-2010 09:07:20

=)

AticAtac

04-03-2010 14:23:23

One more question ;)

In my "app" i plan to have different "pages" (logic + own gui) which can be run at the same time.
Should each page have its own Gui object (and platform too?) or should i have one "global" Gui (+platform) object and the gui on each page will be "child" of this object?
If the 2nd way, is it possible to have logical gui-parts so they can be part of a whole gui?

AticAtac

05-03-2010 09:18:23

@my.name
do you have any idea?

Altren

05-03-2010 09:32:46

You don't need many MyGUI instances (and you actually you can't, since most of them is singletons).

What we usually do is having layout or set of layouts for each "page". Usually each layout is wrapped with BaseLayout class (it used in most demos and tools) and resulting class contain pointers to all layout's widgets and all related to layout logic.
So each wrapped layout is instances that doesn't depend on other GUI parts.

Look at Demo_Colour as an example: there we have EditPanel and ColourPanel. As you can see this two classes represent two windows (each have it's own layout) and all related logic is inside those classes. And they are completely independent.

[Edit: yay, I got 500 posts :P ]

AticAtac

05-03-2010 09:58:15

Thx, i will use layouts.

Right now i am doing the following init order:

...
mPlatform->initialise(...)
mGUI->initialise(...)
...
createScence(...) -> creating light, camera and viewport
...
creating widgets

With the above init order no widgets are shown ! If i call "createScene()" before platform and gui initialisation then it works.
So my question: does mygui need the camera or viewport created before?
( this has also something to do with the question of this guy:
viewtopic.php?f=17&t=12117
which was never answered
)

To sum it together: Is it possible to have mygui working with several RenderWindows ? I may have one or more viewports showing different parts of the world (using different cameras) and want to have (party) gui-widgets shown on them.

thx in advance

BTW: did i mention that mygui is great?

Altren

05-03-2010 20:21:07

You either should create it before platform initialisation or provide where to render gui after you created viewport. http://www.ogre3d.org/wiki/index.php/MyGUI_FAQ

AticAtac

06-03-2010 08:07:44

Thx again for your answer.

Just to for my understanding:
Having the gui working over multipile viewports isn't possible, right?

AticAtac

07-03-2010 12:59:06

anyone knows if mygui will work on multipile viewports?

AticAtac

08-03-2010 13:07:40

Well, after reading through the docs and forum, i believe the only solution to my problem is one could use multipile mygui instances (different gui-objects for different viewports).

Can anyone confirm this ?

Altren

08-03-2010 16:01:00

MyGUI is rendered into one viewport and also ant layer can be rendered into texture (and use that texture anywhere). It's not possible to create two instances of Gui. Actually I believe that it's not necessary to render MyGUI in several viewports.

AticAtac

08-03-2010 16:16:20

So the "game window" should be rendered into a texture ? Is there a performance hit for this? And doesn't need the texture be power of 2 ?
I wonder because that what i want to achieve is a very general "thing": having gui on whole screen and somewhere (usually in the middle) the render window,
And maybe even more "viewports", e.g. minimap where one also need to push some buttons.
So i wonder how people handle all these with one GUI instance.

Altren

08-03-2010 16:38:51

This is not separate viewports at all. You simply creating new windows. And for minimap you generate minimp itself (any way you want - with rtt or whatever, this is not gui part) and then setting texture that you got into StaticImage by setImageTexture.
So in your case no additional viewports required.

AticAtac

08-03-2010 17:25:05

By "new windows" you mean RenderWindow oder mygui-windows ?

Altren

08-03-2010 17:47:59

I probably misunderstood you a bit, but anyway let's say you need gui everywhere and in center - 3d view. You should do next thing: render your 3d view into texture (RTT), then assign texture that you got to StaticImage that is in the middle (or wherever) of your screen.

AticAtac

08-03-2010 18:00:59

The problem with this method will be that my 3D-window needs to have size of power of 2 or ?
Also, will there be a performance penalty for using rtt ?

Altren

08-03-2010 18:11:35

Texture should have power of two size size, but don't need to use whole texture if you don't want to. Also you can scale or crop it.
And about penalty of rtt. This is question for Ogre developers, but I don't understand what you compare with.

AticAtac

08-03-2010 18:19:56

First thx for your answers.

What i want to do is nothing unusall, so i was wondering that i've to use rtt. I was thinking there was some "layer" above the viewports in which the gui could write.

One way i was also thinking is to have the 2 viewports and draw my own mouse cursor in the 2nd (game) viewport.

Actually the RenderBox demo coming with mygui does almost the job. Is it possible get window's title and frame hidden? If yes, then i could use this instead or ?

Altren

08-03-2010 19:04:04

Actually the RenderBox demo coming with mygui does almost the job. Is it possible get window's title and frame hidden? If yes, then i could use this instead or ?There is Window and widget that show viewport. And you simply need that widget without Window, so don't create it and that's all.

AticAtac

08-03-2010 19:07:25

thx, i will try this :D
(is this method something you would also prefer?)

"There is Window and widget that show viewport. And you simply need that widget without Window, so don't create it and that's all."
What do you mean with "widget that show viewport" ? RenderBox ? If so, RenderBox requires window !

AticAtac

09-03-2010 08:46:38

I have some more questions:

- is there a manual which explains the widgets in more details ?
- what is the relation between wraps::RenderBox and MyGUI::RenderBox ?
- i created a canvas (MyGUII::createWidget) but it wasn't shown on screen. By creating it through MyGUI::Window it was visible! Why ?

thx in advance for answering the questions!

Altren

09-03-2010 09:11:19

- is there a manual which explains the widgets in more details ?No. Try to play with widgets in LayoutEditor. Also see where they used in demos.
- what is the relation between wraps::RenderBox and MyGUI::RenderBox ?RenderBox is deprecated and was kept for backward capability. This is actually Canvastypedef Canvas RenderBox;
- i created a canvas (MyGUII::createWidget) but it wasn't shown on screen. By creating it through MyGUI::Window it was visible! Why ?Well, I'm not sure what are you doing, but visual representation doesn't depend on if widget have parent or not. You probably missed something.

AticAtac

09-03-2010 09:22:58

This code works:

const MyGUI::IntSize& size = getGUI()->getViewSize();
MyGUI::Window* window = getGUI()->createWidget<MyGUI::Window>("WindowCS", MyGUI::IntCoord(10, size.height - 10 - 230, 300, 230), MyGUI::Align::Default, "Overlapped");
window->setCaption("Camera view");
window->setMinSize(100, 100);
MyGUI::Canvas* canvas = window->createWidget<MyGUI::Canvas>("Canvas", MyGUI::IntCoord(0, 0, window->getClientCoord().width, window->getClientCoord().height), MyGUI::Align::Stretch);
gRenderBox.setCanvas(canvas);
gRenderBox.setViewport(getCamera());
gRenderBox.setBackgroundColour(MyGUI::Colour::Black);


But this doesn't work (i eliminated the window): the canvas isn't shown!

const MyGUI::IntSize& size = getGUI()->getViewSize();
MyGUI::Canvas* canvas = getGUI()->createWidget<MyGUI::Canvas>("Canvas", MyGUI::IntCoord(10, size.height - 10 - 230, 300, 230), MyGUI::Align::Stretch, "MyCanvas");
gRenderBox.setBackgroundColour(MyGUI::Colour::Black);
gRenderBox.setCanvas(canvas);
gRenderBox.setViewport(m_camera);

Altren

09-03-2010 09:55:42

In second case you use m_camera instead of getCamera() and not calling gRenderBox.setBackgroundColour(MyGUI::Colour::Black);.
So reason is definitely not in window.

AticAtac

09-03-2010 10:01:14

Sorry, i just looked up.
In the 1st version i also use m_camera.
And in the 2nd version i called setBackgroundColour(...).
So camera and backgroundcolour are the same, but the 2nd version still doesn't show up!

Altren

09-03-2010 10:08:07

You attached Canvas to "MyCanvas" layer that doesn't exist. Look at MyGUI.log when encountering wrong behaviour.
Q: Something works wrong. Why?
A: Check MyGUI.log.

AticAtac

09-03-2010 10:13:19

That solved the problem. I used "Overlapped" instead.

Many thx for your help :) :) :)

I will now leave you in peace :mrgreen:

(one more question ;):
Is it possible to turn off Window-title? Is it possible to have Window-title but not being able to move the Window?
If not, do you plan these for future versions?