CEGUI and stateManager ( clearScene()? ) problem

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
User avatar
KWAHU
Gnoblar
Posts: 3
Joined: Tue May 04, 2004 12:10 pm
Contact:

CEGUI and stateManager ( clearScene()? ) problem

Post by KWAHU »

I'm not sure if its the case but in my stateManager I clearScene each time I change a given state. Everything works fine until I want to go back to a state that was using CEGUI.

When I enter the state with GUI for the first time everything is okay. Then I go to another state and then I wan to go back to the state that was using CEGUI and there I have abnormal program termination ... ;(

I can't find what is the problem I tried to only show and hide the window but it didn't help.
Than I tried to destroy the whole window.
I tried to destroy and load the image sets again.

That is what I am doing everytime I exit a state

Code: Select all

	void CAuthorizationState::exit()
	{
		mGuiSheet->hide();  ///for now

		mSceneManager->clearScene();
		mSceneManager->removeAllCameras();
		mRoot->getAutoCreatedWindow()->removeAllViewports();
	}

Maybe

Code: Select all

	CEGUI::OgreCEGUIRenderer* getGUIRenderer();
	CEGUI::System* getGUISystem();
are directly connected with the Scene? and I should initialize them again?

This is how I do it in the singleton

Code: Select all


CGUIManager::CGUIManager()
{
	// setup GUI system
	mGUIRenderer = new CEGUI::OgreCEGUIRenderer(Ogre::Root::getSingleton().getAutoCreatedWindow(),
		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*)"Advert-12");

	CEGUI::Logger::getSingleton().setLoggingLevel(CEGUI::Informative);
}

but I dont do it every time I clearScene() maybe that is the problem??
But from what I see it's only connected with Ogre::Root::getSingleton().getAutoCreatedWindow()
and I dont destroy it.


thanx

User avatar
KWAHU
Gnoblar
Posts: 3
Joined: Tue May 04, 2004 12:10 pm
Contact:

Post by KWAHU »

I also control the rendering and start it again at the end of initialization of every state. Maybe you can't do that when CEGUI system and renderer are created?

User avatar
KWAHU
Gnoblar
Posts: 3
Joined: Tue May 04, 2004 12:10 pm
Contact:

Post by KWAHU »

ok I've found what was the problem.

The pointer to the main GUI window was in the state itself!
And I destroy the state so I was loosing the pointer..grrr
No I keep it in the GUI manager

Post Reply