I am currently trying to integrate CEGUI into an existing project. I started with the OpenGL/SDL example in the wiki, which I can run flawlessly. Then I tried to integrate that into my code. For simplicity, I just took the function drawing the menu and added the CEGUI calls to that.
The code looks like this:
Code: Select all
#include <CEGUI/CEGUI.h>
#include <CEGUI/renderers/OpenGLGUIRenderer/openglrenderer.h>
int cegui_initialized = 0;
static CEGUI::OpenGLRenderer* ce_renderer;
static CEGUI::Window* ce_window;
static double last_time_pulse;
void runmenu(void) {
if (!cegui_initialized) {
ce_renderer = new CEGUI::OpenGLRenderer(0);
new CEGUI::System(ce_renderer);
CEGUI::Logger::getSingleton().setLoggingLevel(CEGUI::Insane);
CEGUI::SchemeManager::getSingleton().loadScheme("../datafiles/schemes/TaharezLook.scheme");
CEGUI::FontManager::getSingleton().createFont("../datafiles/fonts/Commonwealth-10.font");
CEGUI::System::getSingleton().setDefaultFont("Commonwealth-10");
CEGUI::System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");
ce_window = CEGUI::WindowManager::getSingleton().loadWindowLayout("../datafiles/test.layout");
CEGUI::System::getSingleton().setGUISheet(ce_window);
last_time_pulse = 0.001 * static_cast<double>(SDL_GetTicks());
cegui_initialized = 1;
}
// do old menu stuff
{
double t = 0.001 * SDL_GetTicks();
CEGUI::System::getSingleton().injectTimePulse(float(t - last_time_pulse));
last_time_pulse = t;
}
// draw old menu
CEGUI::System::getSingleton().renderGUI();
}
Everything loads OK, the old menu works as before, but CEGUI just doesn't show anything. Are there some OpenGL states that have to be set for CEGUI to work in addition to those in the initPerFrameStates method? Or what else could it be?
