Page 1 of 1

how can I show my ceguilayout and the ogre overlay at the sa

Posted: Thu Apr 14, 2005 10:01
by jasom_liu
I want to show a bmp graphic as the background and a cegui layout as the UI in ogre,but i failed. it's only show the ogre overlay ,where is my ceguilayout and my mouse?? :( my createScene function is shown below:
i think maybe i create the overlay in a wrong place.
How can i do it ? Thanks very much.


void createScene(void)
{

//My Ogre Overlay
Overlay *lay = OverlayManager::getSingleton().create ("background");
OverlayContainer* cont = (OverlayContainer*)OverlayManager::getSingleton().createOverlayElement("Panel", "Login");
MaterialPtr pMat = MaterialManager::getSingleton().create( "TextMat",ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME );
pMat->getTechnique(0)->getPass(0)->createTextureUnitState( "Login.BMP" );
cont->setMaterialName("TextMat");
lay->setZOrder(500);
lay->add2D(cont);
lay->show();

// setup GUI system
mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000);

mGUISystem = new CEGUI::System(mGUIRenderer);
// load scheme and set up defaults
CEGUI::SchemeManager::getSingleton().loadScheme(
(CEGUI::utf8*)"WindowsLook.scheme");
mGUISystem->setDefaultMouseCursor(
(CEGUI::utf8*)"WindowsLook", (CEGUI::utf8*)"MouseArrow");
mGUISystem->setDefaultFont((CEGUI::utf8*)"simsun");

using namespace CEGUI;

Window* sheet =
WindowManager::getSingleton().loadWindowLayout(
(CEGUI::utf8*)"Login.layout.xml");
mGUISystem->setGUISheet(sheet);

}

Re: how can I show my ceguilayout and the ogre overlay at th

Posted: Thu Apr 14, 2005 16:47
by spannerman
I believe that the OGRE overlay is hiding all your CEGUI renderables, including your mouse. I dont know if it possible to change the z-order of overlays so that they appear behind CEGUI widgets...perhaps you should ask them about this over at the OGRE fourms?

Alternatively, you could use a large StaticImage instead of an overlay to display the background image.

Re: how can I show my ceguilayout and the ogre overlay at th

Posted: Sun Apr 17, 2005 05:48
by jasom_liu
Thanks,I have done it~

Re: how can I show my ceguilayout and the ogre overlay at th

Posted: Mon Apr 25, 2005 18:55
by zander1976
Hello

I am trying to do the same thing with ogre as well. I was wondering if you could post the solution.

Thanks, Ben

ps. Try using [ code ] [ /code ] without spaces and the smilies will not show up.

Re: how can I show my ceguilayout and the ogre overlay at th

Posted: Tue Apr 26, 2005 07:28
by jasom_liu
You just need to change the next parameter "false" to "true" :)
// setup GUI system
mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000);

Re: how can I show my ceguilayout and the ogre overlay at th

Posted: Tue Apr 26, 2005 13:30
by zander1976
Hey, great.

Worked like a charm. There are some changes with Ogre1.0.

Code: Select all


    void createScene(void)
    {

      //My Ogre Overlay
      Overlay *lay = OverlayManager::getSingleton().create ("background");
      OverlayContainer* cont = (OverlayContainer*)OverlayManager::getSingleton().createOverlayElement("Panel", "Login");
      MaterialPtr pMat = MaterialManager::getSingleton().create( "TextMat",ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME );
      pMat->getTechnique(0)->getPass(0)->createTextureUnitState( "Login.jpg" );
      cont->setMaterialName("TextMat");
      lay->setZOrder(500);
      lay->add2D(cont);
      lay->show();

      // setup GUI system
      mGUIRenderer = new CEGUI::OgreRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, true, 3000);

      mGUISystem = new CEGUI::System(mGUIRenderer);

      // load scheme and set up defaults
      CEGUI::SchemeManager::getSingleton().loadScheme(
         (CEGUI::utf8*)"TaharezLook.scheme"
      );
      mGUISystem->setDefaultMouseCursor(
         (CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow"
      );
      //Tahoma-12
      mGUISystem->setDefaultFont((CEGUI::utf8*)"Tahoma-12");
      //mGUISystem->setDefaultFont((CEGUI::utf8*)"simsun");

      using namespace CEGUI;

      Window* sheet = WindowManager::getSingleton().loadWindowLayout(
         (CEGUI::utf8*)"Login.layout"
      );
      mGUISystem->setGUISheet(sheet);
   }


Thanks, Ben