Page 1 of 1

Verbatim Hello World Code Crashes

Posted: Fri Dec 30, 2011 22:49
by slavik262
I'm currently building an image analysis program using OpenCV for video decoding and some analysis, OGRE for display, and CEGUI for the UI. I'm currently just attempting to get the hello world code found on the wiki here:

Code: Select all

using namespace CEGUI;
WindowManager& wmgr = WindowManager::getSingleton();
Window* myRoot = wmgr.createWindow( "DefaultWindow", "root" );
System::getSingleton().setGUISheet( myRoot );
FrameWindow* fWnd = (FrameWindow*)wmgr.createWindow( "TaharezLook/FrameWindow", "testWindow" );
myRoot->addChildWindow( fWnd );
// position a quarter of the way in from the top-left of parent.
fWnd->setPosition( UVector2( UDim( 0.25f, 0 ), UDim( 0.25f, 0 ) ) );
// set size to be half the size of the parent
fWnd->setSize( UVector2( UDim( 0.5f, 0 ), UDim( 0.5f, 0 ) ) );
fWnd->setText("Hello World!");


On the line:

Code: Select all

FrameWindow* fWnd = (FrameWindow*)wmgr.createWindow( "TaharezLook/FrameWindow", "testWindow" );

I get the following error message:
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.


I'm aware of what what the stack pointer is, how calling conventions work, etc, so I'm assuming that this is either an internal error with CEGUI or there's some issue with how my project is set up, since I'm not passing any function pointers around.

I am using:
  • Visual Studio 2010
  • Multi-threaded Debug DLL (/MDd)
  • Precompiled OGRE libraries from the latest stable release, OGRE 1.7.3 SDK for Visual C++ .Net 2010 (32-bit)
  • Precompiled CEGUI libraries from the CEGUI 0.7.5 Binary Downloads for Microsoft Visual C++ 2010 downloads section

Any help would be greatly appreciated.

Re: Verbatim Hello World Code Crashes

Posted: Sat Dec 31, 2011 03:01
by saejox
my bet: that code is outdated.
here is what i am doing in 0.7.5 and ogre 1.7

Code: Select all

mGuiRender = &CEGUI::OgreRenderer::bootstrapSystem();
   CEGUI::Imageset::setDefaultResourceGroup("Imagesets");
   CEGUI::Font::setDefaultResourceGroup("Fonts");
   CEGUI::Scheme::setDefaultResourceGroup("Schemes");
   CEGUI::WidgetLookManager::setDefaultResourceGroup("LookNFeel");
   CEGUI::WindowManager::setDefaultResourceGroup("Layouts");
   CEGUI::SchemeManager::getSingleton().create("TaharezLook.scheme");
   CEGUI::System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");

   //END CEGUI Int.
   CEGUI::WindowManager &wmgr = CEGUI::WindowManager::getSingleton();
   CEGUI::Window *sheet = wmgr.createWindow("DefaultWindow", "CEGUI/Sheet");
   CEGUI::System::getSingleton().setGUISheet(sheet); 

   CEGUI::FontManager::getSingleton().create("DejaVuSans-7.font");

   //Life Bar, Item menu, character  details menu,

   mLifeBar = CEGUI::WindowManager::getSingleton().loadWindowLayout("lifebar.layout");
   
   CEGUI::System::getSingleton().getGUISheet()->addChildWindow(mLifeBar);

Re: Verbatim Hello World Code Crashes

Posted: Sat Dec 31, 2011 05:12
by slavik262
saejox wrote:my bet: that code is outdated.
here is what i am doing in 0.7.5 and ogre 1.7


I don't think so. I have the following setup code beforehand, which I got from the OGRE tutorial for CEGUI basics here. Maybe later I'll use all of the code from the tutorial, but it looked more advanced than a basic "Hello World" test.

Code: Select all

CEGUI::Imageset::setDefaultResourceGroup("Imagesets");
CEGUI::Font::setDefaultResourceGroup("Fonts");
CEGUI::Scheme::setDefaultResourceGroup("Schemes");
CEGUI::WidgetLookManager::setDefaultResourceGroup("LookNFeel");
CEGUI::WindowManager::setDefaultResourceGroup("Layouts");
CEGUI::SchemeManager::getSingleton().create("TaharezLook.scheme");
CEGUI::System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");


Even if the code I'm using is outdated, there's still nothing there that should cause the stack pointer to get messed up like that. Like I said before, that seems to be indicative of either a bad project configuration or something wrong with the CEGUI build.

Re: Verbatim Hello World Code Crashes

Posted: Sat Dec 31, 2011 09:26
by CrazyEddie
I don't remember exactly, but I think the 0.7.5 prebuilt binaries for CEGUI were compiled against the 1.7.2 release of Ogre - so unless the Ogre releases are ABI compatible you will potentially have all kinds of unexplained crashes and issues.

The solution will likely be to rebuild the CEGUIOgreRenderer module against the version of Ogre you're using.

CE.

Re: Verbatim Hello World Code Crashes

Posted: Tue Jan 03, 2012 23:20
by slavik262
CrazyEddie wrote:I don't remember exactly, but I think the 0.7.5 prebuilt binaries for CEGUI were compiled against the 1.7.2 release of Ogre - so unless the Ogre releases are ABI compatible you will potentially have all kinds of unexplained crashes and issues.

The solution will likely be to rebuild the CEGUIOgreRenderer module against the version of Ogre you're using.

CE.


This solved the issue. I built CEGUI against OGRE 1.7.2 and everything seems to work now.

Thanks for the help!