using MyGUI with other frameworks

andreahmed

19-06-2012 13:24:47

Hi All,

I'm trying to use Cinder www.libcinder.org with MyGUI and I had a lot of problems.
First I tried to use the opengl renderer, and I tried to write a class to inherit from opengimageloader and implemented the two functions loadimage and save image.
I get an exception in the initilaization in here

void OpenGLRenderManager::initialise(OpenGLImageLoader* _loader)
{
MYGUI_PLATFORM_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice");
MYGUI_PLATFORM_LOG(Info, "* Initialise: " << getClassTypeName());


my code I'm using

class myClass: public MyGUI::OpenGLImageLoader
{
public:
void*loadImage(int& _width, int& _height, MyGUI::PixelFormat& _format, const std::string& _filename);
void saveImage(int _width, int _height, MyGUI::PixelFormat _format, void* _texture, const std::string& _filename);

};

void* myClass::loadImage( int& _width, int& _height, MyGUI::PixelFormat& _format, const std::string& _filename )
{
std::string fullname = MyGUI::OpenGLDataManager::getInstance().getDataPath(_filename);

gl::Texture mTexture;
mTexture = gl::Texture( ci::loadImage( _filename ) );
Surface16u surface(mTexture);
return surface.getData();
}

void myClass::saveImage( int _width, int _height, MyGUI::PixelFormat _format, void* _texture, const std::string& _filename )
{

}
class BasicApp : public AppBasic{
public:

void setup();
// Cinder will always call this function whenever the user drags the mouse
void mouseDrag( MouseEvent event );
void keyDown( KeyEvent event );
// Cinder calls this function 30 times per second by default
void draw();

// This will maintain a list of points which we will draw line segments between
list<Vec2f> mPoints;

};
void BasicApp::setup()
{
MyGUI::OpenGLPlatform *m_myPlatform = new MyGUI::OpenGLPlatform();

myClass *loader = new myClass();
m_myPlatform->initialise(loader);
m_myPlatform->getDataManagerPtr()->addResourceLocation("MyGUI_Media", false);

MyGUI::Gui *m_myGui = new MyGUI::Gui();
m_myGui->initialise("core.xml");

}

Altren

24-06-2012 16:19:39

Well, looks like it is not about opengl or image loading. You simply called OpenGLRenderManager::initialise twice somehow. Check that first.