Ogre Cegui
Posted: Tue Sep 27, 2011 12:09
Hello i have successfully made an ogrecegui minmap.
The code is like this.
The problem is that the image of the map doesn't show up right away. Its black initially. When i click on it, it works. I don't understand why. If i add the image to a sheet directly , it will works right away. This doesn't work with my program design though. Please help . Thanks
The code is like this.
Code: Select all
fWnd7 = static_cast<CEGUI::FrameWindow*>(
wm.createWindow( "TaharezLook/FrameWindow", "testWind5" ));
fWnd7->setProperty("Visible","true");
fWnd7->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.80f, 0 ), CEGUI::UDim( 0.7f, 0 ) ) );
fWnd7->setSize( CEGUI::UVector2( CEGUI::UDim( 0.25f, 0 ), CEGUI::UDim( 0.6f, 0 ) ) );
sheet->addChildWindow( fWnd7 );
Ogre::TexturePtr rtt_texture = Ogre::TextureManager::getSingleton().createManual("RttTex", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D, mWindow->getWidth(), mWindow->getHeight(), 0, Ogre::PF_R8G8B8, Ogre::TU_RENDERTARGET);
Ogre::RenderTexture *renderTexture = rtt_texture->getBuffer()->getRenderTarget();
renderTexture->addViewport(mCamera);
renderTexture->getViewport(0)->setClearEveryFrame(true);
renderTexture->getViewport(0)->setBackgroundColour(Ogre::ColourValue::Black);
renderTexture->getViewport(0)->setOverlaysEnabled(false);
CEGUI::Texture &guiTex = rRenderer->createTexture(rtt_texture);
CEGUI::Imageset &imageSet =
CEGUI::ImagesetManager::getSingleton().create("RTTImageset", guiTex);
imageSet.defineImage("RTTImage",
CEGUI::Point(0.0f, 0.0f),
CEGUI::Size(guiTex.getSize().d_width,
guiTex.getSize().d_height),
CEGUI::Point(0.0f, 0.0f));
si = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticImage", "RTTWindow");
si->setSize(CEGUI::UVector2(CEGUI::UDim(0.8f, 0),
CEGUI::UDim(0.50f, 0)));
si->setPosition(CEGUI::UVector2(CEGUI::UDim(0.25f, 0),
CEGUI::UDim(0.55f, 0)));
si->setProperty("Image", CEGUI::PropertyHelper::imageToString(&imageSet.getImage("RTTImage")));
fWnd7->addChildWindow(si);
The problem is that the image of the map doesn't show up right away. Its black initially. When i click on it, it works. I don't understand why. If i add the image to a sheet directly , it will works right away. This doesn't work with my program design though. Please help . Thanks