[SOLVED] Integrating 0.8.3 with SFML 2.1 and OpenGL
Posted: Thu Jan 02, 2014 17:13
I am following this outdated SFML + CEGUI tutorial, using SFML 2.1 and CEGUI 0.8.3 (on Linux, with the GLRenderer).
I've made numerous modifications to the code, and the SFML skeleton is working. However, CEGUI is only working partially: The initial view renders correctly, but it doesn't seem to be repainted properly, so the mouse cursor leaves a visible trail. Moreover, once I start adding a native SFML "draw()" of an "sf::Text" piece of string, the CEGUI mouse cursor disappears entirely.
Moreover, the edit box doesn't show any text. However, if I remove the line "mWindow.draw(mString);" in the code below, the edit box does show the text.
Update: If I add "mWindow.clear()" at the beginning of the loop, the trails disappear, but as soon as I try drawing the SFML text, all the CEGUI graphics disappear entirely and the window is just black, and with the SFML string the only thing on it.
I believe that my rendering integration of CEGUI into SFML is broken. Could you perhaps advise on what the basic rendering logic should look like, or perhaps spot the error in my design?
The code for "mGUIManager.Draw()" is:
Many thanks!
I've made numerous modifications to the code, and the SFML skeleton is working. However, CEGUI is only working partially: The initial view renders correctly, but it doesn't seem to be repainted properly, so the mouse cursor leaves a visible trail. Moreover, once I start adding a native SFML "draw()" of an "sf::Text" piece of string, the CEGUI mouse cursor disappears entirely.
Moreover, the edit box doesn't show any text. However, if I remove the line "mWindow.draw(mString);" in the code below, the edit box does show the text.
Update: If I add "mWindow.clear()" at the beginning of the loop, the trails disappear, but as soon as I try drawing the SFML text, all the CEGUI graphics disappear entirely and the window is just black, and with the SFML string the only thing on it.
I believe that my rendering integration of CEGUI into SFML is broken. Could you perhaps advise on what the basic rendering logic should look like, or perhaps spot the error in my design?
Code: Select all
while (mWindow.isOpen())
{
if (mDone) { mWindow.close(); return; }
for (sf::Event event; mWindow.pollEvent(event); )
{
if (mGUIManager.handleEvent(event))
{
continue;
}
switch (event.type)
{
case sf::Event::Closed:
Stop();
break;
case sf::Event::KeyPressed:
if (event.key.code == sf::Keyboard::Escape) { Stop(); }
break;
default:
;
}
}
// Is this correct?
// sf::Window mWindow; sf::Text mString;
mWindow.draw(mString);
mGUIManager.Draw();
mWindow.display();
}
The code for "mGUIManager.Draw()" is:
Code: Select all
void Draw()
{
CEGUI::System::getSingleton().renderAllGUIContexts();
}
Many thanks!