How to change imageset image dinmically.

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

HexDump
Just popping in
Just popping in
Posts: 19
Joined: Fri Mar 07, 2008 11:49

How to change imageset image dinmically.

Postby HexDump » Thu Mar 13, 2008 11:13

Hi all,

I´m trying to change the image of a StaticImage dynamically. The only way I have seen to do this is through a imageset. The imageset has a method defineImage where you insert an image in the set. Well, I have to change this image dynamically because it is a render to texture operation. I want to reuse the CEGUI::Texture and the CEGUI::Imageset for all operations, is this possible? I have this by now:

Code: Select all

   
        //Do next rtt operation
   RenderTexture* pTex=m_pSceneBurner->TakeShot();   
   //Texture regenarated
   CEGUI::Texture *cTex = pRenderer->createTexture((CEGUI::utf8*)"RttTex");
            
        //I previously created the  imageset this way
       
        static CEGUI::Imageset *imageSet = CEGUI::ImagesetManager::getSingleton().createImageset((CEGUI::utf8*)"RttImageset", cTex);
   imageSet->defineImage((CEGUI::utf8*)"RttImage",
      CEGUI::Point(0.0f, 0.0f),
      CEGUI::Size(cTex->getWidth(), cTex->getHeight()),
      CEGUI::Point(0.0f,0.0f));

        //So now I want to change dynamically the cTex data to reuse the texture I create before, and this way have the imageset first image change. What I´m trying to do is not recreate texture everytime and not recreate imageset. I want to reuse this ones.

   CEGUI::Window* pImage=*m_StaticImages.begin();
   pImage->setProperty("Image", CEGUI::PropertyHelper::imageToString(&imageSet->getImage((CEGUI::utf8*)"RttImage")));




Any help on this?

If anyone needs any more information let me know please.

HexDump.

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Thu Mar 13, 2008 18:34

To get this right, you are going to update 'cTex' and you want it to be visible on the image, right? If that's so, then IIRC updating cText from now on should do the trick. Since your ImageSet just has a pointer to it. Not a copy.

If you search for (but i think you already did) 'CreateTexture', you can find code alike yourse...

However i am not sure whether you are going to modify cTex in memory, or want to actually replace the Image with new files from disk. If that's so, you might look into the Texture's 'loadFromFile' method.

HTH.
Check out my released snake game using Cegui!

HexDump
Just popping in
Just popping in
Posts: 19
Joined: Fri Mar 07, 2008 11:49

Postby HexDump » Thu Mar 13, 2008 22:36

Thanks for the answer.

HexDump.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 2 guests