print self.texture.getOpenGLTexture() <------------------
Code: Select all
#AttributeError: 'Texture' object has no attribute 'getOpenGLTexture'
Exception AttributeError: "'NoneType' object has no attribute 'OpenGLRenderer'" in <bound method BaseApp.__del__ of <__main__.BaseApp object at 0x7ffdfb8bab90>> ignored
opengl_renderer.py
Code: Select all
CEGUI_ns.class_( 'Texture' ).include(already_exposed=True)
texture = CEGUI_ns.class_("OpenGLTexture")
texture.include()
texture.noncopyable = True
mb.add_declaration_code(
"""
CEGUI::Texture* castAsGLTexture(CEGUI::Texture * e){
if( dynamic_cast< CEGUI::OpenGLTexture* >( e ) ){
return (CEGUI::OpenGLTexture*) e;
}
return ( e );
}
void *
Utility_CastVoidPtr ( unsigned long address )
{
return (void *) address;
}
"""
)
mb.add_registration_code("""def ("castAsGLTexture", &::castAsGLTexture,\
(bp::arg("source")), \
bp::return_value_policy<bp::reference_existing_object, bp::default_call_policies>());""")
mb.add_registration_code("""def ("CastVoidPtr", &::Utility_CastVoidPtr,\
(bp::arg("source")), \
bp::return_value_policy< bp::return_opaque_pointer >());""")
python_CEGUIOpenGLRenderer.h
Code: Select all
#include "CEGUI/RendererModules/OpenGL/Texture.h"
This is my test code:
Code: Select all
def createTexture(self,parent):
im = open('/media/sdb5/Libraries/OGRE/sdk/v1-9/share/OGRE/Media/materials/textures/checker.png')
width = im.size[0]
height = im.size[1]
image = im.convert("RGBA").tostring("raw", "RGBA")
size = PyCEGUI.Sizef(float(width), float(height))
rs = PyCEGUI.System.getSingleton().getRenderer()
self.texture = rs.createTexture("Checked",size)
imageArea = PyCEGUI.Rectf(0.0, 0.0, float(width), float(height))
print self.texture.getOpenGLTexture() <------------------
#tex = PyCEGUIOpenGLRenderer.castAsGLTexture(self.texture)
import ctypes
bm = (ctypes.c_ubyte * width*height*4)()
ctypes.memmove(bm, image, len(image))
tex.blitFromMemory(PyCEGUIOpenGLRenderer.CastVoidPtr(ctypes.addressof(bm)),imageArea)
The common_utils.py has hard·wired paths for the gccxml exe and updating/generating the wrapped code would make it not possible to supply a patch since the generated code would be platform specific.