Overlays [solved]

mikael

27-07-2010 11:15:12

I am using these wrong or maybe a bug?
When using overlays, texts does not appear on the screen before I "touch" them,
example:

protected void UpdateStats()
{
try
{
RenderTarget.FrameStats stats = window.GetStatistics();

OverlayElement oe = OverlayManager.Singleton.GetOverlayElement("label1");
oe.Caption = "FPS: " + stats.LastFPS;
oe = OverlayManager.Singleton.GetOverlayElement("label2");
oe.Caption = oe.Caption;
oe = OverlayManager.Singleton.GetOverlayElement("label3");
oe.Caption = oe.Caption;
oe = OverlayManager.Singleton.GetOverlayElement("label4");
oe.Caption = oe.Caption;
}
catch
{
// ignore
}
}

this works because I made a "hack code", "oe.Caption = oe.Caption;" but without them,
texts isnt visible.

Btw, I have made CreateOverlay program which takes some pieces of *.Designer.cs code
(file made and saved with VS C# 2008 (only tested)) to .overlay and .material file.
You can find it there: http://haima.dy.fi/ogre/cs
(will make it convert button and plane info too, not making a GUI-plugin but simple reader)

Beauty

29-07-2010 12:11:42

I have no experience with overlays.
Is there an interesting warning or error in the ogre.log file?

Also you could check the reason for excetions in your catch block.
catch (Exception e)
{
Console.WriteLine("Exception: " + e.Message);
if (e.InnerException != null)
Console.WriteLine("Inner exception: " + e.InnerException.Message);
}


Maybe the place of the RenderQueueGroup is interesting.
For my transparent objects (created by ManualObject) I use this:
manOb.RenderQueueGroup = Convert.ToByte(RenderQueueGroupID.RENDER_QUEUE_OVERLAY - 2);
Maybe there is something similar to overlays.

Also there is one (or more) code snippet for text overlays with Mogre in the wiki.
(I hate the bad search function of the new wiki :evil: )
In the wiki I added some links to the overlay page.
http://www.ogre3d.org/tikiwiki/-Overlay
Also on the GUI page are useful links:
http://www.ogre3d.org/tikiwiki/-GUI

Beauty

29-07-2010 12:23:00

Now I found the wanted page:
http://www.ogre3d.org/tikiwiki/Easy+Deb ... +for+MOGRE
Text by overlay.

mikael

30-07-2010 18:05:33

Surprisingly, now I tested my code, it does not need "oe.Caption = oe.Caption;" lines anymore.
Dont know what I changed or anything but now it seems to work right (just remembered that I installed yesterday newest ati graphics drivers).

Added WriteLines to catch-block, and if texts disappears again, will check if there was exception.