Overlays in mogre

dwardu

14-03-2011 16:46:12

I am having a little problem to show some text using the overlay, i am writing the code below and the hello world text doesnt show in my scene unless i resize the window after it started.
var overlay = OverlayManager.Singleton.Create("Test");

var panel = (PanelOverlayElement)OverlayManager.Singleton.CreateOverlayElement("Panel", "TestPanel");
panel.MaterialName = "Core/StatsBlockCenter";
panel.MetricsMode = GuiMetricsMode.GMM_PIXELS;
panel.Top = mRenderWindow.Height - 200;
panel.Left = 200;
panel.Height = 200;
panel.Width = 250;

var text = (TextAreaOverlayElement)OverlayManager.Singleton.CreateOverlayElement("TextArea", "TestTextArea");
text.Caption = "hello world";
text.Top = 75;
text.Left = 75;
text.FontName = "BlueHighway";
text.Colour = ColourValue.White;
text.MetricsMode = GuiMetricsMode.GMM_PIXELS;
text.CharHeight = 16;
text.SetAlignment(TextAreaOverlayElement.Alignment.Center);
text.SetDimensions(250, 200);
panel.AddChildImpl(text);
overlay.Add2D(panel);
text.Show();
panel.Show();



what can be the problem?


I also have a problem when creating overlay scripts for ogre, i defined the folder in my resources.cfg, but when i come to using
OverlayManager.Singleton.GetByName("MyScriptName")

the program throws an exception saying its not found even though i placed the file directory my resources.cfg file points to.

what can be the problem for these two?
Thanks :)

dwardu

16-03-2011 09:24:04

anyone?

McDonte

16-03-2011 19:18:42

I've never used overlays so far but did you take a look at basic tutorial six?
The use of overlays is described there quite good I think.

Beauty

17-03-2011 15:41:04

Hi dwardu,
nice to see you here. :D

A couple of useful links I added to the overlay page in the Ogre wiki:
http://www.ogre3d.org/tikiwiki/-Overlay

I hope the links will help you.
Unfortunately I don't have much time these days. So I can't do more for you now.