Page 1 of 1

CEGUI Exception during initialization ( VC8 )

Posted: Fri Jun 06, 2008 15:45
by strangedays
I am building an application using Ogre, but It throws an exception as it executes

Code: Select all

 this->mSystem = new CEGUI::System(mRenderer);


here is the code:

Code: Select all

SceneManager *mgr = Ogre::Root::getSingletonPtr()->getSceneManager("Default SceneManager");

      RenderWindow * win = ApplicationWindow::GetInstance().getRenderWindow();

   LPDIRECT3DDEVICE9 pD3DDevice;
   win->getCustomAttribute("D3DDEVICE", &pD3DDevice);


        // CEGUI setup
      this->mRenderer = new CEGUI::DirectX9Renderer(pD3DDevice, 0);

      
        this->mSystem = new CEGUI::System(mRenderer);



i have been using CEGUI 0.5 stable release with both Ogre 1.4.7 and 1.4.8 stable releases. No matter what I've tried... It throws a CEGUI::GenericException while creating the CEGUI subsystem.

I don't think it depends on ogre since I tried first using the OgreCEGUIRenderer and then DirectX9Renderer. Pointers are not NULL.

I am using Windows XP Sp2, Ogre 1.4.8, CEGUI 0.5 stable , DirectX9 April 2007 ( working ), Visual Studio .net 2005 Professional with Service Pack 1.

I have been around this problem for a month right now...

Any suggestion? Thanx
:(

Posted: Sat Jun 07, 2008 08:15
by CrazyEddie
Hi, and welcome :)

This is probably a missing XML parser module. See this thread for (one of many) similar issues, if you catch the exception and output the message it will give you a better idea as to what is going on.

And finally, a question :) If you're using Ogre, is there any particular reason you're using the D3D renderer for CEGUI and not the Ogre one that comes with Ogre? If it works, that's fine; just never seen anyone do this before!

CE.

Posted: Sun Jun 08, 2008 12:16
by strangedays
And finally, a question Smile If you're using Ogre, is there any particular reason you're using the D3D renderer for CEGUI and not the Ogre one that comes with Ogre? If it works, that's fine; just never seen anyone do this before!


Well because I thought it could be a OGRE error... so I've been investigating on the error responsebilities... However I didn't think at all about catching that exception. However u were absolutely right: my error is about the XML module.

However ... How can I change the module without recompiling the whole code?... I have been setting the macro as in that post but it is still complaining it can't find the ExpatParser. I've tried to define the macro

Code: Select all

#define CEGUI_DEFAULT_XMLPARSER XercesParser

but it still linking to that module... maybe I miss something...

Thanx! :)

Posted: Sun Jun 08, 2008 13:16
by CrazyEddie
The 'default' default is compiled in, however it is possible to change the default prior to instantiating the CEGUI::System object by way of the static CEGUI::System::setDefaultXMLParserName member (see note below, however). This takes a string holding the name of the parser to use, so for Xerces, it would be "XercesParser".

The above only works correctly in 0.5.0; in 0.6.0 this function is broken (although it will be fixed for the upcoming 0.6.1 release).

HTH

CE.

Posted: Sat Jun 21, 2008 13:43
by strangedays
Thank you very much for your help Eddie... now it works :) ... however i have a very strange problem ( a different one at this time) .

At the beginning of this thread I have been using the DirectX9 renderer libraries... then I switched to normal OgreCEGUIRenderer classes.

I have included both source and header files in my project, so I am building them in my application, cause it is the only way i got my application run without exceptions. And finally it works fine.

Application runs perfectly on debug configuration. If i switch to release configuration i get something like a Null pointer access violation when code executes the following information:

Class: OgreCEGUIRenderer.cpp line 771:

Code: Select all


CEGUI::System::getSingleton().renderGUI();





Exception on module CEGUIBase.dll.

It sounds really weird... Still wondering why. Maybe I miss some configuration preprocessor variable.... I don't know.

There is no Exception control to determine the reason of this problem.

Posted: Sun Jun 22, 2008 08:24
by CrazyEddie
Hi,

Assuming you built your own CEGUI libraries, you will likely need to recompile the Ogre GUI renderer module (i.e. rebuild Ogre against the new CEGUI libs and headers); this is likely why it works when you integrate the Ogre GUI renderer files into your project, but not otherwise.

As to the release build not working, usually this is a config error somewhere - although also ensure that if you're using VC++ 2005, you have SP1 for VS 2005 applied.

CE.

Posted: Mon Jun 23, 2008 17:49
by strangedays
yep... using Visual Studio .net 2005 SP1

Posted: Tue Jun 24, 2008 08:45
by CrazyEddie
Yeah, the only thing that comes to mind then is that it's a configuration issue; wrong C/C++ runtime, perhaps mixing debug and release libs, maybe mixing library versions or something; it's very hard to give the 'right' answer in these situations :)

CE