Page 1 of 1

Runtime error loading widgets

Posted: Wed Dec 27, 2006 20:25
by ed7890
Hi i'm making my first program using OpenGL and CEGUI using VS2003 and i'm having trouble loading the widgets. The program compiles ok but the when i run it, I get a runtime error because it cant load the widgets.

Is there something i'm missing or do i have to put the widgets in a special folder or what?
Thanks for any help.

Code: Select all

int main(int argc, char *argv[])
{

   glutInit(&argc, argv);
   glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
   glutInitWindowSize(640, 480);
   window_id = glutCreateWindow("GLUT Loop");
   try{
      OpenGLRenderer* myRenderer = new OpenGLRenderer(512);
      new System(myRenderer);

      WindowManager winMgr = WindowManager::getSingleton();
      Window* myRoot = winMgr.createWindow("DefaultWindow", "root");
      System::getSingleton().setGUISheet(myRoot);

      SchemeManager::getSingleton().loadScheme("TaharezLook.scheme");
      PushButton* btn = static_cast<PushButton*>(winMgr.createWindow("TaharezLook/Button", "root\mybutton"));
      myRoot->addChildWindow(btn);
      FrameWindow* frmWin = (FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "testWindow");
      myRoot->addChildWindow(frmWin);
      
      frmWin->setPosition( Point( 0.25f, 0.25f ) );
      frmWin->setSize( Size( 0.5f, 0.5f ) );
      frmWin->setText( "Hello World!" );
   }catch(CEGUI::Exception ex){
      MessageBox(NULL, ex.getMessage().c_str(), "Cegui exception", 0);
   }


   glutKeyboardFunc(keyFunc);

   while(keep_running)
   {
      glutMainLoopEvent();
      render();
      System::getSingleton().renderGUI();
      glutSwapBuffers();
   }
   glutDestroyWindow(window_id);
   return 0;
}

Posted: Thu Dec 28, 2006 14:35
by LennyH
What are the specific error messages?

The simplest problem tends to come from having your datapath for finding the schemes/looknfeel/imageset wrong.

Posted: Thu Dec 28, 2006 18:34
by ed7890
It throws the exception
DefaultResource Provider::Load - TaharezLoad.Scheme does not exist

Then there a runtime error that starts with "Assertion failed"

Its must that it doesnt have the right path to find them, but i dont know how to set the path.

Posted: Thu Dec 28, 2006 19:50
by LennyH
http://www.cegui.org.uk/wiki/index.php/ ... ialisation

Take a gander through that. When you load a scheme, worst case scenario is that you can just give the complete, absolute path to the scheme file. You should be able to give a relative path from where your executable is running from, as well.

Posted: Mon Jan 15, 2007 15:54
by ed7890
Hey i still cant get this working and its really wrecking my head.

I'm using the following to load in the .scheme file and that runtime error is gone.

Code: Select all

Scheme* sm = SchemeManager::getSingleton().loadScheme("../datafiles/schemes/TaharezLook.scheme");


But now it gives me this runtime error at that line:

Imageset::xml::startElement - An unexpected error occured while creating a Texture Object from file '../datafiles/imagesets/TaharezLook.tga'

Does anyone know what i'm doing wrong here?

Posted: Tue Jan 16, 2007 09:00
by scriptkid
Hi, here's another interesting link for you:
http://www.cegui.org.uk/wiki/index.php/ ... s_in_0.5.0

But i don't know i whether you use version 0.5 or 0.4. The link only applies to 0.5.

Make sure that your Imageset directory is relatively at the same location from your startup directory as the Schemes directory.

When you don't use the resource groups (the link), the paths inside your files may be relative. Otherwise they should not contain path information at all.

So please open your .Scheme and .Imageset file and have a look at the paths in there.

Good luck! :-)

Posted: Sun Jan 28, 2007 21:33
by ed7890
Hi thanks for the help but i still cant get it working, it still gives me the same error.

I'm using version 0.4. I opened the .Scheme and .Imageset files and tried paths with relative paths and no paths information and i still cant get it workin.

Any ideas? Are there any other files that are used beside the .scheme file, the .imageset file and the .tga file?

Posted: Mon Jan 29, 2007 14:27
by ed7890
Do i need a .dll file for the TarahezLook scheme for it to be loaded up properly?