New wiki article: Advanced Ogre Framework

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4308
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 137
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by spacegaier »

Okay, I will try to change that tonight in the wiki and in the my precompiled release.
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4308
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 137
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by spacegaier »

Update 2011/02/10:
  • added some Linux specific code bits
  • fixed null pointer exception with m_pCurrentObject
  • when being in a question dialog you cannot press escape anymore to prevent the application from funny behavior
  • corrected pauseAppState()
So, if I did not miss anything all known issues except for one should be solved and wiki pages should be up to date with all the errata posted here.

Bug: gioramies, you are correct. I just updated the DLLs I use for my framework and now I have the same issue with the label font, you reported. No clue where it comes from. Will investigate once I find the time. It might also make sense to contact omniter since he was the one developing the SDKTrays library (AFAIK). Perhaps he has an idea or even spotted the same problem.
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4308
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 137
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by spacegaier »

ghiboz wrote:hi all, how can I use the loading bar with this advanced ogre framework=

thanks in advance
You could have a look at the Ogre SDK samples code. There is a loading bar used. Never tried it myself though...
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
User avatar
ghiboz
Goblin
Posts: 205
Joined: Wed Apr 25, 2007 9:47 pm
Location: Centallo (I)
x 2
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by ghiboz »

spacegaier wrote:You could have a look at the Ogre SDK samples code. There is a loading bar used. Never tried it myself though...
hi! thanks for your reply... I tried to use the code I used before that worked without the framework: the code is this:

in initOgre function i removed this:

Code: Select all

Ogre::String secName, typeName, archName;
Ogre::ConfigFile cf;
cf.load("resources.cfg");

Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
while (seci.hasMoreElements())
{
    secName = seci.peekNextKey();
    Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
    Ogre::ConfigFile::SettingsMultiMap::iterator i;
    for (i = settings->begin(); i != settings->end(); ++i)
    {
        typeName = i->first;
        archName = i->second;
        Ogre::ResourceGroupManager::getSingleton().addResourceLocation(archName, typeName, secName);
    }
}
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();

and I added this:

Code: Select all

Ogre::ResourceGroupManager::getSingleton().addResourceLocation(	"data/Ogre/SdkTrays.zip", "Zip", "Essential" );
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(	"data/Ambient", "FileSystem", "General" );
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(	"data/Ogre/Sinbad.zip", "Zip", "General" );
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(	"data", "FileSystem", "General" );
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(	"data/SkyX", "FileSystem", "SkyX" );


Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("Essential");

m_pTrayMgr = new OgreBites::SdkTrayManager("AOFTrayMgr", m_pRenderWnd, m_pMouse, 0);

m_pTrayMgr->showLoadingBar();
Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("General");
Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("SkyX");
m_pTrayMgr->hideLoadingBar();	
the system loads correctly the general and skyx group, but the screen remains black and after a while, appears the menu state without show the loading bar...

thanks
User avatar
ghiboz
Goblin
Posts: 205
Joined: Wed Apr 25, 2007 9:47 pm
Location: Centallo (I)
x 2
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by ghiboz »

I solved, I show the loadingbar in menustate & gamestate in the enter method after the camera creation & the assignment of the camera to the scene:

Code: Select all

void MenuState::enter()
{
    OgreFramework::getSingletonPtr()->m_pLog->logMessage("Entering MenuState...");

    m_pSceneMgr = OgreFramework::getSingletonPtr()->m_pRoot->createSceneManager(ST_GENERIC, "MenuSceneMgr");
    m_pSceneMgr->setAmbientLight(Ogre::ColourValue(0.7f, 0.7f, 0.7f));

    m_pCamera = m_pSceneMgr->createCamera("MenuCam");
    m_pCamera->setPosition(Vector3(0, 25, -50));
    m_pCamera->lookAt(Vector3(0, 0, 0));
    m_pCamera->setNearClipDistance(1);

    m_pCamera->setAspectRatio(Real(OgreFramework::getSingletonPtr()->m_pViewport->getActualWidth()) /
        Real(OgreFramework::getSingletonPtr()->m_pViewport->getActualHeight()));

    OgreFramework::getSingletonPtr()->m_pViewport->setCamera(m_pCamera);

	//OgreFramework::getSingletonPtr( )->m_pTrayMgr = new OgreBites::SdkTrayManager("AOFTrayMgr", m_pRenderWnd, m_pMouse, 0);

	OgreFramework::getSingletonPtr( )->m_pTrayMgr->showLoadingBar();
	Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("General");
	Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("SkyX");
	OgreFramework::getSingletonPtr( )->m_pTrayMgr->hideLoadingBar();


    OgreFramework::getSingletonPtr()->m_pTrayMgr->destroyAllWidgets();
    OgreFramework::getSingletonPtr()->m_pTrayMgr->showFrameStats(OgreBites::TL_BOTTOMLEFT);
    OgreFramework::getSingletonPtr()->m_pTrayMgr->showLogo(OgreBites::TL_BOTTOMRIGHT);
    OgreFramework::getSingletonPtr()->m_pTrayMgr->showCursor();
    OgreFramework::getSingletonPtr()->m_pTrayMgr->createButton(OgreBites::TL_CENTER, "EnterBtn", "Enter GameState", 250);
    OgreFramework::getSingletonPtr()->m_pTrayMgr->createButton(OgreBites::TL_CENTER, "ExitBtn", "Exit AdvancedOgreFramework", 250);
    OgreFramework::getSingletonPtr()->m_pTrayMgr->createLabel(OgreBites::TL_TOP, "MenuLbl", "Menu mode", 250);

    createScene();
}
using this way is also cool that I load for each state some separated things...
I hope this little snippet needs to someone

regards
m4xhua
Gnoblar
Posts: 4
Joined: Sat Feb 12, 2011 9:06 pm
Location: Germany

Re: New wiki article: Advanced Ogre Framework

Post by m4xhua »

Hello,

first i have to thank you for your great Framework, it saved me a lot of time. I noticed that it is unable to load Terrain from the DotScene format, because the DotSceneLoader is deleted right after parsing the .scene file. To fix this,

in GameState.cpp i changed

Code: Select all

DotSceneLoader* pDotSceneLoader = new DotSceneLoader();
pDotSceneLoader->parseDotScene("CubeScene.xml", "General", m_pSceneMgr, m_pSceneMgr->getRootSceneNode());
delete pDotSceneLoader;
to

Code: Select all

m_pLoader->parseDotScene("CubeScene.xml", "General", m_pSceneMgr, m_pSceneMgr->getRootSceneNode());
and moved the instantiation of it to GameState Constructor:

Code: Select all

m_pLoader = new DotSceneLoader();
and added

Code: Select all

DotSceneLoader* m_pLoader;
to GameState private Attributes. Of course you have to delete m_pLoader in destructor of GameState.

If you delete m_pLoader before destruction of GameState, application will crash when moving from gamestate to menustate and back.
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4308
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 137
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by spacegaier »

That's correct if you need the DotScene Loader more than once and in multiple places in the GameState class, you cannot directly delete it. I will however not change that in my framework to keep things clean.

But I do not understand the Terrain thing. In none of your code lines is the terrain ever popping up. Am I missing something?
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
m4xhua
Gnoblar
Posts: 4
Joined: Sat Feb 12, 2011 9:06 pm
Location: Germany

Re: New wiki article: Advanced Ogre Framework

Post by m4xhua »

Terrain is handled by DotScene Loader, so you dont need to take care of it directly. If you load a DotScene file, for example the SampleProject included in Ogitor, all objects will be loaded correctly, but the Terrain will not be displayed if you delete the DotSceneLoader.
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4308
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 137
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by spacegaier »

m4xhua wrote:[...] the Terrain will not be displayed if you delete the DotSceneLoader.
Wow, are you sure about that? I cannot confirm or deny that (never really toyed around with Terrain yet), but that would most certainly be strange IMHO.
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
m4xhua
Gnoblar
Posts: 4
Joined: Sat Feb 12, 2011 9:06 pm
Location: Germany

Re: New wiki article: Advanced Ogre Framework

Post by m4xhua »

Yes, take a look here http://www.ogre3d.org/forums/viewtopic.php?f=5&t=58474, seems they have that problem.
Ogre::TerrainGroup* mTerrainGroup, in which the terrain is loaded by the dotSceneLoader is deleted upon destruction of the dotSceneLoader, so the Terrain is deleted while the other objects remain attached to the SceneManager you pass to the DotSceneLoader.
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4308
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 137
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by spacegaier »

Okay, perhaps because this is a member of the loader:

Code: Select all

Ogre::TerrainGroup* mTerrainGroup;
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
m4xhua
Gnoblar
Posts: 4
Joined: Sat Feb 12, 2011 9:06 pm
Location: Germany

Re: New wiki article: Advanced Ogre Framework

Post by m4xhua »

Yes, there may be a way to get this work with holding mTerrainGroup somewhere else and delete dotsceneloader immediately, but deleting dotsceneloader on Gamestate destruction seems easier and memory consistant to me. And you dont have to alter the dotsceneloader.
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4308
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 137
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by spacegaier »

Yes, I will think about changing it once I have time for that...
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
dave2041
Halfling
Posts: 71
Joined: Fri Apr 24, 2009 12:55 pm

Re: New wiki article: Advanced Ogre Framework

Post by dave2041 »

Just want to start by saying i love the Advanced Ogre Framework ^^

a small change i've just made... as i like to work with the console in debug mode and without in release. This causes a linking error:

Code: Select all

2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
This can be resolved by simply adding " && !defined( _DEBUG )" to the first #if statement, making it:

Code: Select all

#if OGRE_PLATFORM == PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WIN32 && !defined( _DEBUG )
Just in case it helps anyone.

Also out of the box canceling at the renderer selection screen causes an exception, just curious what cause this?
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4308
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 137
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by spacegaier »

dave2041 wrote:Also out of the box canceling at the renderer selection screen causes an exception, just curious what cause this?
No, crash here. What does the log say? Does that happen with my compiled solution or when you compile my solution?
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
dave2041
Halfling
Posts: 71
Joined: Fri Apr 24, 2009 12:55 pm

Re: New wiki article: Advanced Ogre Framework

Post by dave2041 »

Wow, it doesn't! I now feel like an idiot... when i cancel from the renderer selection screen in release or debug i get an unhandled exception:

Code: Select all

Unhandled exception at 0x010812c8 in AdvancedOgreFramework.exe: 0xC0000005: Access violation reading location 0xcdcdcdcd.
at the line:

Code: Select all

    if(mTrayMgr)      delete mTrayMgr;
Despite the mTrayMgr being null (0xcdcdcdcd) which the if should recognise and move on surly?

Also, is your project in 2008? because i only have 05' and 2010 so i get the project conversion wizard and need to add in the includes/libs etc again~
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4308
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 137
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by spacegaier »

Strage. If you do not press cancel the whole application runs fine, right?
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
dave2041
Halfling
Posts: 71
Joined: Fri Apr 24, 2009 12:55 pm

Re: New wiki article: Advanced Ogre Framework

Post by dave2041 »

Absolutely, no complaints with the framework otherwise.

main function returns 0;
DemoApp trys to delete the ogre framework pointer: delete OgreFramework::getSingletonPtr();
AdvancedOgreFramework trys to delete mTrayMgr even though it's null: if(mTrayMgr) delete mTrayMgr;

Strange right?
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4308
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 137
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by spacegaier »

Found the issue. Will update in a second...
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
dave2041
Halfling
Posts: 71
Joined: Fri Apr 24, 2009 12:55 pm

Re: New wiki article: Advanced Ogre Framework

Post by dave2041 »

Guessing it was the order in which destructor's were being called?

Just niggled at me slightly ha-ha, even though no one except me is likely to press cancel (when i think of something else I'd like to change before seeing the latest build.)

Thanks again for your awesome project :)
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4308
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 137
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by spacegaier »

Updated the first post and the RAR archive. Wiki article is next...

EDIT: In the BasicOgreFramework is all fine already, since I nulled the pointer there at startup, but obviously forgot it in this framework here :oops:

Edit 2: Wiki article fixed as well now. Issue marked as solved on my ToDo list :) .
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
dave2041
Halfling
Posts: 71
Joined: Fri Apr 24, 2009 12:55 pm

Re: New wiki article: Advanced Ogre Framework

Post by dave2041 »

The small errors are the best, just confirmed that was the error. For some reason my eyes saw mInputMgr as mTrayMgr in the constructor rofl.
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4308
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 137
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by spacegaier »

New update, see first post.
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
singmelody
Gnoblar
Posts: 11
Joined: Sun Dec 19, 2010 11:03 pm

Re: New wiki article: Advanced Ogre Framework

Post by singmelody »

Wonderful simple Framework.
But I want to ask a question.
I have known that the the message system in MFC is based on pass of the message ,but the message system in QT is based on signal slot.
So I have a question here , the framework here is based on what ?
I think it is like the pass of the message , not like QT.
I am right ?
Hope for the answer , thank you . :D
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4308
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 137
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by spacegaier »

Not really sure. To me the KeyListener thing of Ogre sounds like message-passing but I have never digged into the subject. Sorry.
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
Post Reply