Ogre Cegui

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

JohnBoyMan
Just popping in
Just popping in
Posts: 16
Joined: Thu Aug 25, 2011 21:51

Ogre Cegui

Postby JohnBoyMan » Tue Sep 27, 2011 12:09

Hello i have successfully made an ogrecegui minmap.
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 :rofl:

Return to “Help”

Who is online

Users browsing this forum: No registered users and 15 guests