06-10-2006 00:44:33

I'm trying to take an Ogre texture and put it into a StaticImage.

texturePtr = textureManager.getByName(name)
print texturePtr

<pyogre.ogre.ResourcePointer; proxy of <Swig Object of type 'Ogre::ResourcePtr *' at 0x3978ea8> >

texture = ceguiRenderer.createTexture(texturePtr)
No matching function for overloaded 'OgreCEGUIRenderer_createTexture'

So it seems to be getting the texturePtr okay (as a ResourcePtr), but createTexture() doesn't seem to find a matching method.

Am I missing something obvious?


06-10-2006 15:12:48

texturePtr = ogre.TexturePointer(textureManager.getByName(name) )

There are problems with the texture returned by "guiRenderer.createTexture" it returns a PySwigObject instead of a Cegui::Texture, so you'll probably not be able to access it's methods. I'll look at it but from what I remember it was problematic.

Saying that it still semi works. Heres an extract of creating a video in a static image. There's also examples of loading images directly from a file in

VideoTexture = ogre.ExternalTextureSourceManager.getSingleton().getExternalTextureSource("wmvideo")
WMVideoTexture = wmvideo.WMVideoHelper(VideoTexture)

mat3 = ogre.MaterialPointer(ogre.MaterialManager.getSingleton().getByName("VideoMaterial2"))
if not mat3.loaded:
tname = mat3.getTechnique(0).getPass(0).getTextureUnitState(0).getTextureName()
texture = ogre.TexturePointer(ogre.TextureManager.getSingleton().getByName(tname))

print '----------------'
print type(texture)
print dir(texture.get())
print '----------------'

rttTexture = self.guiRenderer.createTexture(texture)
print '----------------'
print type(rttTexture)
#print dir(rttTexture.get())
print '----------------'

w,h = texture.width, texture.height
rttImageSet = cegui.ImagesetManager.getSingleton().createImageset("RttImageset", rttTexture)

rttImageSet.defineImage("RttImage", cegui.Point(0.0, 0.0), cegui.Size(w, h),

# Static Image
#si=CreateControl("TaharezLook/StaticImage", "TestImage" ,sheet ,[0.10,0.10],[0.3,0.85],[0.01,0.01],[1.0,1.0],"Test Image")

si = cegui.WindowManager.getSingleton().createWindow("TaharezLook/StaticImage", "TestImage")
si.position = cegui.Point(0.1,0.1)
si.minimumSize = cegui.Size(0.1,0.1)
si.absoluteWidth = w
si.absoluteHeight = h
si.frameEnabled = True
si.visible =True


06-10-2006 18:38:25

Thanks! The ogre.TexturePointer() did the trick.

Much appreciated!


08-10-2006 22:27:09

Just noticed this:


...curious as to what that's about? Wondering if I reinvented the wheel when I wrapped wmvideo.


09-10-2006 09:26:37

No the WMVideoHelper was just a simple wrapper round the original version of wmvideo to display video using pyCegui and primarily to test ExternalTextureSource. Originally I wanted to update the set/getParameters but enountered problems compiling wmvideo. Anyway it highlighted the Texture problem with pycegui and that something needs to be done about pyogre and Ogre::ParameterList.

I included the test code case in case it was of any use to you.

Anyway nice job on wrapper and build instructions I'll be sure to use your version in the future. Nice if it could be wikied so it doesn't get lost in the forum.