Problem with frame listener registration

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

Tekmoto
Just popping in
Just popping in
Posts: 7
Joined: Fri Apr 14, 2006 06:08

Problem with frame listener registration

Postby Tekmoto » Sun Apr 23, 2006 00:49

Hello again,

I am trying to use CEGUI with Ogre3d. I am having problems using multiple (2) framelisteners. I get the following runtime error:

Program: ..\SampleApp.exe
File: D:\ogredev\dagon\ogremain\include\ogresingleton.h
Line: 59

Expression: !ms_Singleton

Basically, what I am doing is that in my application framelistener, when F10 is pressed, the gui is loaded, and the gui frame listener is added to the ogre root. when the gui is closed, the gui frame listener is removed from the ogre root.

If I ignore this runtime error, everything works perfectly. In fact, I don't get this error when my app frame listener uses unbuffered input handling (it's currently doing buffered input handling). Another interesting note is that if I don't create the gui frame listener, this run-time error doesn't occur (but then i cant control the gui).

I'm not sure what could be wrong.

here is some code from my project:

Code: Select all

    void createScene(void) {
    ...
        mGUI = new GUI(mWindow, mCamera, mSceneMgr, mRoot);
    }

    void createFrameListener(void) {
        // Create the FrameListener
        mFrameListener = new TutorialFrameListener(mWindow, mCamera, mSceneMgr);
        mRoot->addFrameListener(mFrameListener);

        // Show the frame stats overlay
        mFrameListener->showDebugOverlay(false);
    }

=========

GUI::GUI(RenderWindow* win, Camera* cam, SceneManager* sceneMgr, Ogre::Root* ogreRoot)
{
    // setup GUI system
    mGUIRenderer = new CEGUI::OgreCEGUIRenderer(win, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, sceneMgr);
    mGUISystem = new CEGUI::System(mGUIRenderer);
    CEGUI::Logger::getSingleton().setLoggingLevel(CEGUI::Informative);
    CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLook.scheme");
    mGUISystem->setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow");
    mGUISystem->setDefaultFont((CEGUI::utf8*)"Tahoma-12");

    mOgreRoot = ogreRoot;

    CEGUI::Texture* myTexture = mGUIRenderer->createTexture("../media/gui/test.bmp",  ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    CEGUI::Imageset* pImageSet= CEGUI::ImagesetManager::getSingleton().createImageset((CEGUI::utf8*)"ImageSetName", myTexture);
    pImageSet->defineImage((CEGUI::utf8*)"Image", CEGUI::Point(0.0f, 0.0f),CEGUI::Size(800,600),   CEGUI::Point(0.0f,0.0f));

    mCurrentGUI = 0;
    mGuiFrameListener = new GuiFrameListener(win, cam, mGUIRenderer);
}


Any help is much appreciated! - Tek

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

Postby Van » Sun Apr 23, 2006 12:53

From expierence..

Do NOT use multiple framelisteners. Write one framelistener and have it call your classes to pass process control. Believe me, it reduces alot of headaches, not of which, is the one found.

Tekmoto
Just popping in
Just popping in
Posts: 7
Joined: Fri Apr 14, 2006 06:08

Postby Tekmoto » Mon Apr 24, 2006 00:30

I'd like to get this to work, although I recognize the headaches associated with multiple frame listeners.

In the worst case scenario, if this doesn't get resolved, I will use one frame listener as you suggested. Thanks!


Return to “Help”

Who is online

Users browsing this forum: No registered users and 12 guests