Overlay and text problem with ogre 1.9.0 (debian)

Problems building or running the engine, queries about how to use features etc.
Post Reply
ciberfred
Gnoblar
Posts: 7
Joined: Fri Feb 19, 2021 4:09 pm
x 2

Overlay and text problem with ogre 1.9.0 (debian)

Post by ciberfred »

Ogre Version: :1.9.0:
Operating System: :debian:
Render System: :GL:

Get probleme with overlay and text rendering with a specific font.

By the way i try to manage for my app no config files all will be coded at compil time in the executable file.
i try to show a text thru the font DejaVuSans (common in linux) with an overlay.

so i init the overlaysystem and load font manually

Code: Select all

Ogre::OverlaySystem* ovsys = new Ogre::OverlaySystem();
this->m_scn_mgr->addRenderQueueListener(ovsys);

Ogre::FontPtr p_font = Ogre::FontManager::getSingletonPtr()->create("DejaVuSans", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, true);
	p_font->setType(Ogre::FT_TRUETYPE);
	p_font->setSource("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf");
	p_font->setTrueTypeSize(48);
	p_font->setTrueTypeResolution(96);
	p_font->load();
then i create the container

Code: Select all

Ogre::OverlayManager& overm = Ogre::OverlayManager::getSingleton();
overm.destroyAll();
Ogre::Overlay* p_overlay= overm.create("Backglassover");
Ogre::OverlayContainer* p_container;
p_container = static_cast<Ogre::OverlayContainer*>(overm.createOverlayElement("Panel", "GUI"));
p_container->setPosition(0,0);
p_container->setDimensions(1.f,1.f);
p_container->setMetricsMode(Ogre::GMM_PIXELS);
p_overlay->add2D(p_container);
p_overlay->show();
and then the text area that i put in the container :

Code: Select all

Ogre::TextAreaOverlayElement* p_text = static_cast<Ogre::TextAreaOverlayElement*>(overm.createOverlayElement("TextArea", "TextAreaName"));
	p_text->setMetricsMode(Ogre::GMM_PIXELS);
Ogre::MaterialPtr overmat = Ogre::MaterialManager::getSingleton().create("tableoverlayMaterial", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
	p_text->setMaterialName("tableoverlayMaterial");
	p_text->setPosition(0,0);
	p_text->setFontName("DejaVuSans");
	p_text->setCharHeight(48.f);
	p_text->setColour(Ogre::ColourValue(1.0f,1.0f,1.0f, 1.0f));
	p_text->setCaption("Hello World!");

	p_container->addChild(p_text);
if i don't create a material ogre complain about not finding it and raise an exception. the result is not the text on screen but the area full of white without the text (but it seems that area is correct as there is no white on the space text..)

Image

somebody could explain me how to show the text with transparency ? i find many code/tutorial but in my case it seems that i miss something but dont' understand what...
Post Reply