Can't see Textoverlay

hiasl

07-07-2006 17:39:11

Hi all,

i try to get a text overlay on screen with the following lines, but i can't see anything :(

overlayManager = ogre.OverlayManager.getSingleton()

#create panel
self._panel = overlayManager.createOverlayElement('Panel', 'PanelName')
self._panel.metricsMode = ogre.GMM_RELATIVE
self._panel.setPosition(0.0, 0.0)
self._panel.setDimensions(1.0, 1.0)

self._textElement = ogre.TextAreaOverlayElement('MessageArea')
self._textElement.metricsMode = ogre.GMM_RELATIVE
self._textElement.setPosition(0.1, 0.1)
self._textElement.setDimensions(0.8, 0.8)
self._textElement.caption = "HELLO WORLD"
self._textElement.charHeight = 16
self._textElement.fontName = "TrebuchetMSBold"
self._textElement.colourBottom = ogre.ColourValue(0.3, 0.5, 0.3)
self._textElement.colourTop = ogre.ColourValue(0.5, 0.7, 0.5)

self._overlay = overlayManager.create('MessageOverlay')
self._overlay.add2D(self._panel)
self._panel.addChild(self._textElement)
self._overlay.show()

when i define a material for the panel, e.g. a bitmap, it is visible, but no words are shown...

Any help would be appreciated!

Thanks in advance
Matthias

dermont

07-07-2006 19:37:39

Try changing the textElement metrics mode to pixels.


#create panel
self._panel = overlayManager.createOverlayElement('Panel', 'PanelName')
self._panel.metricsMode = ogre.GMM_RELATIVE
self._panel.setPosition(0.0, 0.0)
self._panel.setDimensions(1.0, 1.0)
self._panel.materialName="Core/StatsBlockCenter"


self._textElement = ogre.TextAreaOverlayElement('MessageArea')
self._textElement.metricsMode = ogre.GMM_PIXELS
self._textElement.setPosition(110, 110)
self._textElement.setDimensions(100, 100)
self._textElement.caption = "HELLO WORLD"
self._textElement.charHeight = 16
self._textElement.fontName = "TrebuchetMSBold"
self._textElement.colourBottom = ogre.ColourValue(0.3, 0.5, 0.3)
self._textElement.colourTop = ogre.ColourValue(0.5, 0.7, 0.5)

self._overlay = overlayManager.create('MessageOverlay')
self._overlay.add2D(self._panel)
self._panel.addChild(self._textElement)
self._overlay.show()

Mulks

07-04-2009 15:45:44

Hi all, new to python ogre and all and I have this exact same problem.

I can create a 'Panel' and a 'TextArea' overlay element and it compiles without errors, but only the 'Panel' is shown. I'm using the same code here but instead I'm using the 'sample.fontdef' and 'solo5.ttf' files included with the python ogre samples.

I've tried the correction suggested by dermont but still no joy. :(
Has anyone got this working or have any suggestions as to why it may not be.

Thanks, for any help offered.

teuthida

08-12-2010 01:24:49

Hate to bump this, but I'm having the exact same issue as well. It all looks correct, but I only get the panel overlay visible, no text is appearing.

Here is my code:


overlayManager = ogre.OverlayManager.getSingleton()

_panel = overlayManager.createOverlayElement('Panel', 'PanelName')
_panel.metricsMode = ogre.GMM_PIXELS
_panel.setPosition(10, 10)
_panel.setDimensions(500, 100)
_panel.materialName="Core/StatsBlockCenter"


_textElement = ogre.TextAreaOverlayElement('MessageArea')
_textElement.metricsMode = ogre.GMM_PIXELS
_textElement.setPosition(10, 10)
_textElement.setDimensions(100, 100)
_textElement.setCaption("hello world test")
_textElement.charHeight = 16
_textElement.fontName = "Arial"
_textElement.colourBottom = ogre.ColourValue(0, 0, 0)
_textElement.colourTop = ogre.ColourValue(0, 0, 0)

_overlay = overlayManager.create('MessageOverlay')
_overlay.add2D(_panel)
_panel.addChild(_textElement)
_overlay.show()


and here is the fontdef file I created (I tried using the solo5 one as well):


Arial
{
type truetype
source arial.ttf
size 16
resolution 96
}


Any help would be much appreciated!

dermont

10-12-2010 08:52:59

I don't think your issue is the same as the OP. If you are using Ogre1.7.1 then it may be you are encountering the same problem as users on the following link:

http://www.ogre3d.org/forums/viewtopic.php?f=2&t=58047

As a workaround try as suggested there, that is setting the caption only after you have called renderOneFrame for the first time.