rendering with opengl (all fixed)
Posted: Mon Jun 11, 2007 17:36
Hey im trying to add the cegui system into our own graphics engine which uses opengl im kindof cheating and using the cegui opengl system at the moment though ive been using these two forum posts so far
http://www.cegui.org.uk/wiki/index.php/ ... _Rendering
http://www.cegui.org.uk/phpBB2/viewtopic.php?t=1270
ok it all compiles when i run it with the menu system enabled it crashs and says
Microsoft C++ exception: CEGUI::InvalidRequestException at memory location 0x0012d948
i figure im not including something i should in the system could someone look over my implementation briefly and give me a few pointers please
this is my header for cegui inside the engine
implementation file
im using a modified version of sample 7 to initilise the gui object and to call render frame by frame in a while loop since i need to do some other networking stuff too
header for sample
implementation file
the crash occurs in this statement at the throw invalidrequest line in file
ceguidefualtresourceprovider.cpp
it sounds like im missing some file the debug filenames are all numbers so i couldnt get any clues from there
the layout file is modified but it all compiled and displayed fine before i started integrating it to the new engine
these are the only things i use to interact with the cegui system
thankyou for looking at the code if you do
http://www.cegui.org.uk/wiki/index.php/ ... _Rendering
http://www.cegui.org.uk/phpBB2/viewtopic.php?t=1270
ok it all compiles when i run it with the menu system enabled it crashs and says
Microsoft C++ exception: CEGUI::InvalidRequestException at memory location 0x0012d948
i figure im not including something i should in the system could someone look over my implementation briefly and give me a few pointers please

this is my header for cegui inside the engine
Code: Select all
#ifndef GUIINTERFACE_H
#define GUIINTERFACE_H
#define CEGUI_SAMPLES_USE_OPENGL
#include <CEGUI.h>
#include "openglrenderer.h"
using namespace CEGUI;
#pragma comment (lib, "CEGUIBase_d.lib")
#pragma comment (lib, "OpenGLGUIRenderer_d.lib")
class guiInterface
{
public:
guiInterface();
~guiInterface() {cleanUp();}
void initilise();
void Render();
void cleanUp();
private:
FrameWindow* wnd;
System* cegui;
OpenGLRenderer* ceguir;
};
#endif
implementation file
Code: Select all
#include "gui.h"
void guiInterface::initilise()
{
ceguir = new OpenGLRenderer(500);
// CEGUI::Logger().getSingleton().setLoggingLevel(Insane );
cegui = new System(ceguir);
}
guiInterface::guiInterface()
{
wnd = 0;
cegui = 0;
ceguir = 0;
}
void guiInterface::cleanUp()
{
delete System::getSingletonPtr();
}
void guiInterface::Render()
{
if(cegui)
cegui->renderGUI();
}
im using a modified version of sample 7 to initilise the gui object and to call render frame by frame in a while loop since i need to do some other networking stuff too
header for sample
Code: Select all
#ifndef _Sample_Demo7_h_
#define _Sample_Demo7_h_
#include "gui.h"
#include "CEGUI.h"
#include <string>
#include <vector>
#include <iostream>
#include "ServerClient.h"
namespace std {}
using namespace std;
// Sample class
class Demo7Sample
{
private:
bool network_active;
int difficulty;
public:
int getDifficulty() { return difficulty;}
ServerClient network;
// method to initialse the samples windows and events.
bool initialiseSample();
bool getNetworkStatus() { return network_active;}
// method to perform any required cleanup operations.
void cleanupSample(void);
bool run();
protected:
// initialisation helpers
bool quit;
bool updateServers;
bool renderMenu;
void createListContent(void);
void initDemoEventWiring(void);
void initWindows(void);
// methods that process GUI events
bool handleQuit(const CEGUI::EventArgs& e);
bool handleSlider(const CEGUI::EventArgs& e);
bool handleRadio(const CEGUI::EventArgs& e);
bool handleCheck(const CEGUI::EventArgs& e);
bool handleButtonClick(const CEGUI::EventArgs& e);
void swapWindows(string vis,string invis);
guiInterface gui;
};
#endif
implementation file
Code: Select all
#include "Sample_Demo7.h"
#include "CEGUI.h"
#include "CEGuiBaseApplication.h"
#include <cstdlib>
bool Demo7Sample::run()
{
gui.initilise();
initialiseSample();
while(renderMenu)
{
if(getNetworkStatus())
{
network.process();
if(updateServers)
{
}
}
gui.Render();
}
if(quit)
return 1;
else
return 0;
}
bool Demo7Sample::initialiseSample()
{
difficulty = 0;
updateServers = true;
quit = false;
renderMenu = true;
network_active = false;
using namespace CEGUI;
// we will use of the WindowManager.
WindowManager& winMgr = WindowManager::getSingleton();
// load scheme and set up defaults
SchemeManager::getSingleton().loadScheme("TaharezLook.scheme");
System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");
FontManager::getSingleton().createFont("Commonwealth-10.font");
// load an image to use as a background
ImagesetManager::getSingleton().createImagesetFromImageFile("BackgroundImage", "GPN-2000-001437.tga");
// here we will use a StaticImage as the root, then we can use it to place a background image
Window* background = winMgr.createWindow("TaharezLook/StaticImage", "background_wnd");
// set position and size
background->setPosition(UVector2(cegui_reldim(0), cegui_reldim( 0)));
background->setSize(UVector2(cegui_reldim(1), cegui_reldim( 1)));
// disable frame and standard background
background->setProperty("FrameEnabled", "false");
background->setProperty("BackgroundEnabled", "false");
// set the background image
background->setProperty("Image", "set:BackgroundImage image:full_image");
// install this as the root GUI sheet
System::getSingleton().setGUISheet(background);
// load the windows for Demo7 from the layout file.
Window* sheet = winMgr.loadWindowLayout("Demo7Windows.layout");
// attach this to the 'real' root
background->addChildWindow(sheet);
initWindows();
// set-up the contents of the list boxes.
createListContent();
// initialise the event handling.
initDemoEventWiring();
// success!
return true;
}
void Demo7Sample::initWindows(void)
{
//sets all windows invisible but one
}
void Demo7Sample::cleanupSample()
{
// nothing to do here!
gui.cleanUp();
}
void Demo7Sample::initDemoEventWiring(void)
{
//adds event callbacks
}
bool Demo7Sample::handleButtonClick(const CEGUI::EventArgs& e)
{
//swaps windows
// event was handled
return true;
}
//accepts window to make visible, window to make invisible
void Demo7Sample::swapWindows(string vis,string invis)
{
// switchs windows
}
bool Demo7Sample::handleQuit(const CEGUI::EventArgs& e)
{
// signal quit
quit = true;
renderMenu = false;
// event was handled
return quit;
}
the crash occurs in this statement at the throw invalidrequest line in file
ceguidefualtresourceprovider.cpp
Code: Select all
std::ifstream dataFile(final_filename.c_str(), std::ios::binary|std::ios::ate);
if( dataFile.fail())
{
throw InvalidRequestException(
"DefaultResourceProvider::load - " + filename + " does not exist");
}
it sounds like im missing some file the debug filenames are all numbers so i couldnt get any clues from there
the layout file is modified but it all compiled and displayed fine before i started integrating it to the new engine
these are the only things i use to interact with the cegui system
thankyou for looking at the code if you do
