Manually updating a render surface
Posted: Fri Sep 24, 2010 09:12
Hi there.
So what I'm trying to do is render a static text box to render target and then display the text in 3d space, my code is
uncommenting the CEGUI::System::getSingleton().getGUISheet()->addChildWindow(win);
will cause the window to update but then obviuoly I get it in the sheet as well... and presumably I'd be rendering it every fame, both of which are really not what I want.
Any help for a nub?
So what I'm trying to do is render a static text box to render target and then display the text in 3d space, my code is
Code: Select all
CEGUI::WindowManager* winMgr = CEGUI::WindowManager::getSingletonPtr();
CEGUI::Window* win = winMgr->createWindow(
InterfaceCEGUI::PRIMARY_GUI_NAME + "/StaticText", "Test00000");
win->setText("Simple Test");
win->setSize(CEGUI::UVector2(CEGUI::UDim(0.2,0), CEGUI::UDim(0.2, 0)));
win->setPosition(CEGUI::UVector2(CEGUI::UDim(0.4, 0), CEGUI::UDim(0.4, 0)));
win->setUsingAutoRenderingSurface(true);
//CEGUI::System::getSingleton().getGUISheet()->addChildWindow(win);
CEGUI::OgreTextureTarget& target = dynamic_cast<CEGUI::OgreTextureTarget&>(win->getRenderingSurface()->getRenderTarget());
CEGUI::Texture& baseTexture = target.getTexture();
CEGUI::OgreTexture& texture = dynamic_cast<CEGUI::OgreTexture&>(baseTexture);
Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().getByName("CEGUI/RenderSurface");
Ogre::Pass *pass = mat->getTechnique(0)->getPass(0);
pass->getTextureUnitState(0)->setTextureName( texture.getOgreTexture()->getName() );
BillboardSet* bbs = mSceneMgr->createBillboardSet(1);
bbs->setMaterialName(mat->getName());
bbs->setDefaultWidth(3);
bbs->setDefaultHeight(2);
bbs->createBillboard(Vector3(0, 2, 0));
mSceneMgr->getRootSceneNode()->attachObject(bbs);
uncommenting the CEGUI::System::getSingleton().getGUISheet()->addChildWindow(win);
will cause the window to update but then obviuoly I get it in the sheet as well... and presumably I'd be rendering it every fame, both of which are really not what I want.
Any help for a nub?