Resizing a CEGUI Texture

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

User avatar
dermont
Quite a regular
Quite a regular
Posts: 75
Joined: Mon Aug 29, 2005 16:15

Resizing a CEGUI Texture

Postby dermont » Thu Oct 01, 2015 07:03

I'm creating a video texture for Ogre2.1/Cegui0.8 and python wrapper/bindings. If I create a texture on the Ogre side then create a CEGUI::OgreTexture passing the TexturePtr it works fine. I can blitFromMemory either from CEGUI of from Ogre (via CEGUI::OgreTexture::getOgreTexture()).

The problem occurs when I try to create an Ogre texture from CEGUI. Sorry the following is in python.

Code: Select all

cegui_texture = CEGUI.System.getSingleton().getRenderer().createTexture(self.textureName, self.videoSize)


The CEGUI:OgreTexture ctor always creates a 1x1 Ogre texture, on blitFromMemory it fails:

Code: Select all

OGRE EXCEPTION(2:InvalidParametersException): Destination box out of range in GL3PlusHardwarePixelBuffer::blitFromMemory at /media/sdb5/THISISITPYTHONOGRE/BRANCHES/v2-1/downloads/ogre/RenderSystems/GL3Plus/src/OgreGL3PlusHardwarePixelBuffer.cpp (line 126)
Segmentation fault (core dumped)



I tried updating the texture size. The blit doesn't fail but the texture is not displayed.

Code: Select all

    texture = cegui_texture.getOgreTexture()
    texture.freeInternalResources()
    texture.setWidth(int(cegui_texture.getOriginalDataSize().d_width))
    texture.setHeight(int(cegui_texture.getOriginalDataSize().d_height))
    texture.setDepth(1)
    texture.createInternalResources()


As a workaround I manually reset the Ogre texture after the above resize to ensure (d_size / d_dataSize) are the same.

Code: Select all

    cegui_texture.setOgreTexture(cegui_texture.getOgreTexture(), False)


If I update OgreTexture(const String& name, const Sizef& sz) and createEmptyOgreTexture() to create a texture of size (sz) then I don't need the above, is there any reason the texture is not automatically created from the size passed in? Is there something else I am missing?

This is the basic image used to hold the texture. I invalidate all relevant windows and child windows after any texture updates.

Code: Select all

        self.videoBasicImage = CEGUI.ImageManager.getSingleton().create("BasicImage", cegui_texture.getName())
        self.videoBasicImage.setAutoScaled(CEGUI.ASM_Disabled  )
        rect = CEGUI.Rectf(CEGUI.Vector2f(0,0),  cegui_texture.getOriginalDataSize())
        self.videoBasicImage.setArea(rect)
        self.videoBasicImage.setTexture(cegui_texture)


Return to “Help”

Who is online

Users browsing this forum: No registered users and 7 guests