Page 1 of 1

Irrlicht doesn't show anything

Posted: Sun Apr 23, 2006 20:31
by Amarth
Hello all,
I just started with CEGUI. I have done the first couple of tutorials, but at the end of number 3 (The Beginner Guide to Creating a CEGUI Window), nothing shows on my screen, except for an empty window. The mouse cursor isn't changed, either. No errors are generated and the log doesn't show any problems, either. Code:

Code: Select all

#include "irrlicht.h"
#include "CEGUI.h"
#include "renderers/IrrlichtRenderer/irrlichtrenderer.h"

using namespace irr;

int main(){
   IrrlichtDevice *myIrrlichtDevice =
      createDevice(video::EDT_SOFTWARE,core::dimension2d<s32>(512, 384),16,false,false,0);
   myIrrlichtDevice->setWindowCaption(L"CEGUI and the Irrlicht Engine!");
   video::IVideoDriver* myIrrlichtDriver = myIrrlichtDevice->getVideoDriver();
   scene::ISceneManager* myIrrlichtSceneManager = myIrrlichtDevice->getSceneManager();

   CEGUI::IrrlichtRenderer* myRenderer = new CEGUI::IrrlichtRenderer(myIrrlichtDevice, true);
   new CEGUI::System(myRenderer);

   CEGUI::SchemeManager::getSingleton().loadScheme("../datafiles/schemes/TaharezLook.scheme");
   CEGUI::FontManager::getSingleton().createFont("../datafiles/fonts/Commonwealth-10.font");
   CEGUI::System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");

   CEGUI::Window* myRoot = CEGUI::WindowManager::getSingleton().loadWindowLayout("test.layout");
   CEGUI::System::getSingleton().setGUISheet(myRoot);

   while(myIrrlichtDevice->run()){
      myIrrlichtDriver->beginScene(true, true, irr::video::SColor(150,50,50,50));
      myIrrlichtSceneManager->drawAll();
      CEGUI::System::getSingleton().renderGUI();
      myIrrlichtDriver->endScene();
   }

   myIrrlichtDevice->drop();

   return(0);
}
The datafiles are set up as they should be (it throws exceptions, otherwise), and my test.layout file is

Code: Select all

<?xml version="1.0" ?>
<GUILayout>
    <Window Type="DefaultWindow" Name="root">
        <Window Type="TaharezLook/FrameWindow" Name="testWindow">
            <Property Name="UnifiedPosition" Value="{{0.25,0},{0.25,0}}" />
            <Property Name="UnifiedSize" Value="{{0.5,0},{0.5,0}}" />
            <Property Name="Text" Value="Hello World!" />
        </Window>
    </Window>
</GUILayout>
Anyone has any idea?

Another thing is that I find that 'new CEGUI::System(myRenderer);' very suspicious. Isn't that a guarantied leak?

Thank you!

Posted: Mon Apr 24, 2006 20:44
by Amarth
Argh, OK, found it. Software doesn't work - needs to be OpenGL or Direct3D. Replace video::EDT_SOFTWARE with video::EDT_OPENGL and it works...

Thanks, anyway :D.