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();
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();
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);
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...