Seraphis Posted July 27, 2010 Share Posted July 27, 2010 Hello community, I was just looking through the CEGUI tutorial by Laurens and the CEGUI forums for an answer to this little frustrating issue but all to no avail. Essentially the problem is that I keep getting an access violation when I run the program and I'm pretty sure I narrowed it down to the line thats causing the exception. CEGUI::SchemeManager::getSingleton().create("TaharezLook.scheme"); Now, I have a the TaharezLook.scheme in my gui/schemes folder which is in the main folder of my application. I'm using Visual Studio 2010 with the 09 toolset. I've followed the tutorial to a T and have crosschecked my code to it a million times. When checking the CEGUI log file it returns no error. Heres my log. ---- Version 0.7.1 (Build: Jan 27 2010 Microsoft Windows MSVC++ 9.0 32 bit) ---- 27/07/2010 15:22:28 (Std) ---- Renderer module is: CEGUI::OpenGLRenderer - Official OpenGL based 2nd generation renderer module. TextureTarget support enabled via FBO extension. ---- 27/07/2010 15:22:28 (Std) ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ---- 27/07/2010 15:22:28 (Std) ---- Image Codec module is: SILLYImageCodec - Official SILLY based image codec ---- 27/07/2010 15:22:28 (Std) ---- Scripting module is: None ---- ---- CEGUI System initialisation completed ---- 27/07/2010 15:22:28 (Std) 27/07/2010 15:22:28 (Std) Started creation of Scheme from XML specification: 27/07/2010 15:22:28 (Std) ---- CEGUI GUIScheme name: TaharezLook 27/07/2010 15:22:28 (Std) Started creation of Imageset from XML specification: 27/07/2010 15:22:28 (Std) ---- CEGUI Imageset name: TaharezLook 27/07/2010 15:22:28 (Std) ---- Source texture file: TaharezLook.tga in resource group: (Default) So I'm rather confused at there being no error in the log for this... I've posted my code below, I left out a lot of the usual leadwerks code in my program but left my comments. Essentially the program stops getting the access violation when the CEGUI code is removed, and when commenting out the aforementioned line I get no crash, but then obviously the GUI doesnt render. #include "engine.h" #include "CEGUI.h" #include "RendererModules\OpenGL\CEGUIOpenGLRenderer.h" #include "ProcessScene.h" int main(int argc, char** argv) { Initialize(); //Create a graphics context Graphics(1024,768); //Create a world if (!CreateWorld()) { MessageBoxA(0,"Error","Failed to create world.",0); goto exitapp; } //Create a camera //Create a light //Load Scene //Create a render buffer //Configure Character //Reposition Camera //Handle Collisions //Camera & Movement Variables //Init GUI CEGUI::OpenGLRenderer &ceguiRenderer = CEGUI::OpenGLRenderer::create(); CEGUI::System::create(ceguiRenderer); ceguiRenderer.enableExtraStateSettings(true); CEGUI::DefaultResourceProvider *rp = static_cast<CEGUI::DefaultResourceProvider*>(CEGUI::System::getSingleton().getResourceProvider()); rp->setResourceGroupDirectory("schemes", "gui/Schemes/"); rp->setResourceGroupDirectory("layouts", "gui/Layouts/"); rp->setResourceGroupDirectory("looknfeels", "gui/LookNFeels/"); rp->setResourceGroupDirectory("imagesets", "gui/Imagesets/"); rp->setResourceGroupDirectory("fonts", "gui/Fonts/"); CEGUI::Scheme::setDefaultResourceGroup("schemes"); CEGUI::WindowManager::setDefaultResourceGroup("layouts"); CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels"); CEGUI::Imageset::setDefaultResourceGroup("imagesets"); CEGUI::Font::setDefaultResourceGroup("fonts"); CEGUI::SchemeManager::getSingleton().create("TaharezLook.scheme"); CEGUI::FontManager::getSingleton().create( "DejaVuSans-10.font" ); CEGUI::System::getSingleton().setDefaultFont("DejaVuSans-10"); CEGUI::WindowManager &wm = CEGUI::WindowManager::getSingleton(); CEGUI::Window *root = wm.loadWindowLayout("test.layout"); CEGUI::System::getSingleton().setGUISheet(root); //Main loop while(!KeyHit(KEY_ESCAPE)) { //Camera Controls //Character Controls //Update the world UpdateAppTime(); UpdateWorld(); //Render the scene SetBuffer(buffer); RenderWorld(); //Render lighting SetBuffer(BackBuffer()); RenderLights(buffer); //GUI Render glPixelStoref(0x806E, 0); glPixelStoref(GL_PACK_ROW_LENGTH, 0); glPixelStoref(GL_UNPACK_ROW_LENGTH, 0); CEGUI::System::getSingleton().renderGUI(); Flip(); } exitapp: Terminate(); return 0; } If you need any more information from me please let me know. Thanks in advance =). Quote Link to comment Share on other sites More sharing options...
Laurens Posted July 28, 2010 Share Posted July 28, 2010 Does the same thing happen with the example code posted at the bottom of that tutorial? The only thing I can come up with right now is that you have not set your working directory correctly. It should be the same directory as the command. It my case the command is $(TargetPath) and the working directory is thus set to $(TargetDir). Quote Link to comment Share on other sites More sharing options...
Seraphis Posted August 7, 2010 Author Share Posted August 7, 2010 Does the same thing happen with the example code posted at the bottom of that tutorial? The only thing I can come up with right now is that you have not set your working directory correctly. It should be the same directory as the command. It my case the command is $(TargetPath) and the working directory is thus set to $(TargetDir). Its been a few days of tinkering now and I haven't had any luck. I have my command set up properly as well as my working directory. I'm stumped. Quote Link to comment Share on other sites More sharing options...
Seraphis Posted August 7, 2010 Author Share Posted August 7, 2010 I have my files structure set up like this. c:\code\CPP_Projects\testproject\c:\code\CPP_Projects\testproject\source c:\code\CPP_Projects\testproject\source\Debug c:\code\CPP_Projects\testproject\GUI c:\code\CPP_Projects\testproject\media The GUI folder has all the subfolders containing the files for CEGUI, the looksnfeels folder etc. My project settings are like this: *General Settings* Output Directory: (" ..\ ") Imtermediate Directory: (" $(Configuration)\ ") Platform Toolset: v90 *Debugging Settings* Command: (" $(targetpath) ") Working Directory: (" $(targetdir) ") *C++ General Settings* Additional Include Directories: C:\Users\Seraphis\code\Engines\CEGUI\cegui\include; C:\Users\Seraphis\code\Engines\Leadwerks\CPP; *Linker - Input* Additional Dependencies: opengl32.lib CEGUIBase_d.lib CEGUIOpenGLRenderer_d.lib Now, inside of c:\code\CPP_Projects\testproject\ rests my EXE along with the following DLLs CEGUIBase_d.dll CEGUIExpatParser_d.dll CEGUIFalagardWRBase_d.dll CEGUIOpenGLRenderer_d.dll CEGUISillyImageCodec_d.dll silly_d.dll along with the other dlls needed for the engine. The solution, project file, and all the headers/cpp files are in the source folder. Quote Link to comment Share on other sites More sharing options...
Laurens Posted August 9, 2010 Share Posted August 9, 2010 Hi! I am currently still on holiday but when I get back next monday I will send you a sample VS2010 project to see if it is related to your project settings or something else entirely. Right now I don't see any reason why it shouldn't work. Cheers! Quote Link to comment Share on other sites More sharing options...
Seraphis Posted August 10, 2010 Author Share Posted August 10, 2010 I just fixed it, thank god. Thanks for the help anyway man. Quote Link to comment Share on other sites More sharing options...
Laurens Posted August 10, 2010 Share Posted August 10, 2010 Good to hear, what was the issue? Cheers! Quote Link to comment Share on other sites More sharing options...
VeTaL Posted August 1, 2011 Share Posted August 1, 2011 Quite interesting, what was the source of this trouble. Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.