CEGUI flashing

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Lahha
Just popping in
Just popping in
Posts: 1
Joined: Sat Oct 12, 2013 22:50

CEGUI flashing

Postby Lahha » Sat Oct 12, 2013 23:07

Hey!

My problem is that CEGUI seems to show only every other frame. Any idea why this is happening?

Here's a video.
https://www.dropbox.com/s/0njk5r5tel7uj ... %20vid.zip

Ogre Version 1.8.1
CEGUI Version 0.8.2

CEGUI log: http://pastebin.com/Vanqm88a

Thank for your time and effort in helping me!

Main of rendering thread.

Code: Select all

void RenderingThread::EntryPoint(void * param)
{
   //Initialize
   try {
      ogreApp.init();
      ogreApp.openWindow(1024, 768, false, "SpaceSimX");
   } catch (std::exception &e) {
      MessageBox(NULL, (std::wstring(L"Failed to initialize RenderingThread.\n") + widen(e.what())).c_str(), L"Error", MB_ICONEXCLAMATION | MB_OK);
      return;
   }

   ready = true;

   //Ready

   bool run = true;
   bool lVerticalSynchro = true; //vsync

   double lastTime = 0;
   
   Ogre::Root * root = ogreApp.getRoot();
   Ogre::RenderWindow * window = ogreApp.getWindow();
   
   root->clearEventTimes();
   window->getCustomAttribute("WINDOW", &hWindow);
   
   {
      unsigned int width, height, depth;
      int top, left;
      window->getMetrics(width, height, depth, left, top);
   
      Event::OISEventCapturer::init((size_t)hWindow, width, height);
      Event::OISEventCapturer::capture();
   }

   Ogre::WindowEventUtilities::messagePump();

   while(run && ogreApp.isWindowOpen())
   {
      Renderer::sharedPtrType & ar = renderers[activeRenderer];

      if(ar)
      {
         if(!ar->isInitialized())
            ar->initialize(&ogreApp); //Calls GameRenderer::initialize() which calls GuiRenderer::initialize().
         
         Event::OISEventCapturer::capture();

         double deltaTime = double(timer.elapsed() - lastTime);
         lastTime += deltaTime;

         ar->renderFrame(lastTime); //Calls GameRenderer::renderFrame() which calls GuiRenderer::renderFrame().
         
      }

      window->update(false);
      window->swapBuffers(lVerticalSynchro);

      root->renderOneFrame();

      Ogre::WindowEventUtilities::messagePump();
   }

   ready = false;

   for(auto i = renderers.begin(); i != renderers.end(); i++)
      i->second->destroy();

   hWindow = NULL;

}


Essential parts of GuiRenderer class which contains all CEGUI related code.

Code: Select all

void Renderer::initialize(OgreApplication * ogre_)
{
   if(initialized)
      return;

   ogre = ogre_;

   _initialize();
   initialized = true;
}

void GuiRenderer::_initialize()
{
   try {
      _ceRenderer = &CEGUI::OgreRenderer::bootstrapSystem(*ogre->getWindow());
      //CEGUI::System::create(*_ceRenderer);

      using namespace CEGUI;

      Ogre::ResourceGroupManager& lRgMgr = Ogre::ResourceGroupManager::getSingleton();
      lRgMgr.createResourceGroup("cegui");
      lRgMgr.addResourceLocation("CEGUI", "FileSystem", "cegui", false);
      lRgMgr.initialiseResourceGroup("cegui");
      lRgMgr.loadResourceGroup("cegui");

      // set the default resource groups to be used
      CEGUI::ImageManager::setImagesetDefaultResourceGroup("cegui");
      CEGUI::Font::setDefaultResourceGroup("cegui");
      CEGUI::Scheme::setDefaultResourceGroup("cegui");
      CEGUI::WidgetLookManager::setDefaultResourceGroup("cegui");
      CEGUI::WindowManager::setDefaultResourceGroup("cegui");
      CEGUI::ScriptModule::setDefaultResourceGroup("cegui");
   
      // setup default group for validation schemas
      CEGUI::XMLParser* parser = CEGUI::System::getSingleton().getXMLParser();
      if (parser->isPropertyPresent("SchemaDefaultResourceGroup"))
         parser->setProperty("SchemaDefaultResourceGroup", "schemas");

      //load scheme
      SchemeManager::getSingleton().createFromFile("TaharezLook.scheme", "cegui");
      FontManager::getSingleton().createFromFile("DejaVuSans-10.font", "cegui");

      System::getSingleton().getDefaultGUIContext().getMouseCursor().setDefaultImage( "TaharezLook/MouseArrow" );

      WindowManager& wmgr = WindowManager::getSingleton();

      Window* myRoot = wmgr.createWindow( "DefaultWindow", "root" );
      System::getSingleton().getDefaultGUIContext().setRootWindow( myRoot );

      FrameWindow* fWnd = static_cast<FrameWindow*>(wmgr.createWindow( "TaharezLook/FrameWindow", "testWindow"));
      myRoot->addChild( fWnd );
      // position a quarter of the way in from the top-left of parent.
      fWnd->setPosition( UVector2( UDim( 0.25f, 0 ), UDim( 0.25f, 0 ) ) );
      // set size to be half the size of the parent
      fWnd->setSize( USize( UDim( 0.5f, 0 ), UDim( 0.5f, 0 ) ) );
      fWnd->setText( "Hello World!" );

   } catch (std::exception & e) {
      std::cout << e.what() << std::endl;
      throw std::exception(e.what());
   }
}

void GuiRenderer::renderFrame(double time)
{
   if(_clock < 0)
      _clock = time - 0.01;

   CEGUI::System::getSingleton().injectTimePulse(time - _clock);

   _clock = time;
}

Return to “Help”

Who is online

Users browsing this forum: No registered users and 39 guests