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
Ident
Gremlin
Posts: 155
Joined: Thu Sep 17, 2009 8:43 pm
Location: Austria
x 9
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by Ident »

Hello, I'm new to this forum and this is my first post, so I hope I won't do anything wrong already in my first post here :D

I downloaded your advanced ogre framework, and set up the VS project so that it should work, i encountered numerous problems so far, but mostly project file related and could fix them all so far, however now i reached the state where that part should be done and it should run BUT in Debug Mode, just after building and before i actually see anything, i get some kinda memory access violation on the following line:

AdvancedOgreFramework.cpp in void OgreFramework::initOgre(...) just after a couple of lines:

Code: Select all

m_pRoot = new Ogre::Root();
however the Visual Studio Debugger wasnt really helpful in this case as to what I would be experienced and expecting in such situations. However, I dont have the knowledge of Ogre to be able to think of any reason for such a violation, as far as i have seen this is a very basic call of the most basic Constructor of the engine, so I dont see any complications that could be existing there

I'm confused

For your info: I use Visual Studio 2008 (in this case) and have the latest stable Ogre Engine in use for this,... (1.6.3)

It says it's some kinda of reading violation, but I couldnt find how else you would create or use Ogre:Root(), if not like this anyways


In case it might be of any help, that's the call (?) where it crashes:
AdvancedOgreFramework.exe!OgreFramework::initOgre(std::basic_string<char,std::char_traits<char>,std::allocator<char> > wndTitle="AdvancedOgreFramework", OIS::KeyListener * pKeyListener=0x00000000, OIS::MouseListener * pMouseListener=0x00000000) line 56 + 0xde bytes C++
Any ideas before i start sticking needles into my eyes?
(will be still working on this on my own till any responses, if i find anything I will report)

PS: I forgot to mention: In release mode I get till the Ogre Engine Rendering Setup (Dx / Opengl Switcher and Settings) and after that it crashes due to a similar error in crtexe.c , but i guess that's not helpful either
Ident
Gremlin
Posts: 155
Joined: Thu Sep 17, 2009 8:43 pm
Location: Austria
x 9
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by Ident »

Okay I overlooked a log file and found something in there now:

CEGUI.log says in the last line
17/09/2009 21:59:54 (Error) WindowManager::loadWindowLayout - loading of layout from file 'AdvancedOgreFramework.layout' failed.
no that sounds a lot more revealing than some reading violation..

i just wonder why googling for my violation problem didnt lead me to this, well with this new info i ll now try to fix it, sorry for double post and being so newbish *hides* :oops:
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 135
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by spacegaier »

No problem :) . At least it seems as if you would have done your homework before posting (using debugger, googling, ...) and even found out the error yourself.

If you should encounter any other problems, don't hesitate to post again!
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...
Ident
Gremlin
Posts: 155
Joined: Thu Sep 17, 2009 8:43 pm
Location: Austria
x 9
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by Ident »

jesus, yea i did my homework, i usually never even ask for help and just fight my way through, but it took me more than 20 minutes just for this bug and i didnt get any further at all and didnt see any forthcoming, so i posted here, also i googled a lot and as i said i couldnt find anything, but now, with my post, somebody maybe will find the solution easier also on google :D

And, well, the C++ Debugger isnt always of use, most times it doesnt guide me anywhere, it's just like someone slapping me in the face and saying "WRONG" - but without giving real hints to the reason it's wrong - when i get an error in the Debugger..
Especially if the bugs appear in some weird locked file that i did never touch or even know :roll: , that' s pain

Okay now i got the Release version to build and run, (reorganized my whole project after i saw there is actually stuff in the bin folder, lol, when i first read there is "media" i thought of the Ogre media and included that one, *embarassed*), however the debug version didnt work,... until i changed Plugins.cfg to the right files ( Plugin=RenderSystem_Direct3D9_d
Plugin=RenderSystem_GL_d )

just for info, in case anyone as newbish as me should encoutner this problem

everything works fine, looks great, good work (as far as i can tell as noob), spacegaier!

only one small thing i noticed: when switching modes from camera control to chat, and back, the icon for the chat stays there until you trigger some method, like through clicking somewhere

just thought i'd tell you, but i guess you were aware of that small bug anyways :)
I hope i can come back in case i encounter any problems using your framework, thx a lot for making it, i hope it will help me with my project
Ident
Gremlin
Posts: 155
Joined: Thu Sep 17, 2009 8:43 pm
Location: Austria
x 9
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by Ident »

now i got a little more indepth into it, and i still like it


i got a question about the mainloop:

variables are defined double

Code: Select all

double timeSinceLastFrame = 1;
double startTime = 0;
but

Code: Select all

startTime = OgreFramework::getSingletonPtr()->m_pTimer->getMillisecondsCPU();
this function returns an unsigned integer

as you dont divide or multiply in the loop and only do one substraction between those variables in the loop, i don't see why you would use double as data type, but maybe i overlooked something - so i thought i better ask before i change something :D
Ident
Gremlin
Posts: 155
Joined: Thu Sep 17, 2009 8:43 pm
Location: Austria
x 9
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by Ident »

Another small change i made to my framework was that i aligned the cursors of OIS and CEGUI to be on the same point, as of the state of this framework, they aren't, which can lead to problems in your program

So to do this, just enter this Codesnippet in your enter() function of the State you wanna have that in (most likely the GameState will need it, in the MenuState i assume it won't matter in most cases) :

Code: Select all

	const OIS::MouseState state = OgreFramework::getSingletonPtr()->m_pMouse->getMouseState();
	CEGUI::Point mousePos = CEGUI::MouseCursor::getSingleton().getPosition();  
	CEGUI::System::getSingleton().injectMouseMove(state.X.abs-mousePos.d_x,state.Y.abs-mousePos.d_y);
I took the code from the wiki and modified it for this framework


hope it helps anyone who will ever wonder why the mouse returns different results as to be seen :D
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 135
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by spacegaier »

Okay, thanks for the feedback. I now found the time to go through it again and changed some things:
  • added try/catch stuff in manageAppState()
  • changed timeSinceLastFrame and startTime to int
  • added the OIS / CEGUI cursor alignment lines from Ident
  • added a security check in the Framework destructor as it was reported to fail otherwise on Linux (reported in the BasicOgreFramework thread)

    Code: Select all

    if(m_pInputMgr)
    {
    	delete m_pKeyboard;
    	delete m_pMouse;
    	OIS::InputManager::destroyInputSystem(m_pInputMgr);
    }
  • little change in main() so that only e.what() is used
I did not change the place where the layouts are loaded as this doesn't take long here. In a "real" application that would be done somewhere else though (in a function that only gets called for every state once).

I also found a minor bug. If you start the application and the OgreConfig window appears and you either click "Cancel" or hit the "Esc" key, the application however starts. Will have to check how the Demos or the ExampleApplication handles this. Or perhaps one of you has already changed it his project and would like to tell me ;)

Wiki pages are changed and new out-of-the-box-running versions are uploaded.
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...
Ident
Gremlin
Posts: 155
Joined: Thu Sep 17, 2009 8:43 pm
Location: Austria
x 9
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by Ident »

Edited: 1. there is something still not being perfect about my cursor alignment, i just noticed that when trying something in my program - i will check on that very soon and post about it -- *** Checked and I was mistaken - it works perfectly with that code snippet.. The source of my problem was something totally different :D ***

else
2. i implemented all changes u did in my program, however i had a problem with AppStateManager::manageAppState() then - i had a build error on

Code: Select all

delete state;
i fixed that by instead using the line

Code: Select all

state->destroy();
instead, which basically shouldn't make much of difference (or does it??)

As i made other changes in my framework, i 'm not sure if it's just me - and most of all - where it comes from, but i thought i might report this - if it doesn't matter then just ignore me :)

oh and i thought it's on feature that the program starts on "Cancel", not a bug :D, still hope someone finds a way to solve this
jonnys
Halfling
Posts: 77
Joined: Thu Mar 27, 2008 7:40 pm

Re: New wiki article: Advanced Ogre Framework

Post by jonnys »

spacegaier wrote: I also found a minor bug. If you start the application and the OgreConfig window appears and you either click "Cancel" or hit the "Esc" key, the application however starts. Will have to check how the Demos or the ExampleApplication handles this. Or perhaps one of you has already changed it his project and would like to tell me ;)
I changed it in mine. Here's the code:

In OgreFramework::initOgre()

Code: Select all

if(m_pRoot->showConfigDialog())
{
      // If returned true, user clicked OK so initialise
      // Here we choose to let the system create a default rendering window by passing 'true'
      m_pRenderWnd = m_pRoot->initialise(true, wndTitle);        
}
else
{
     return false;
}
Then in DemoApp::startDemo() :

Code: Select all

//Cancel program if it is false
if (!OgreFramework:getSingletonPtr()->initOgre("AdvancedOgreFramework", 0, 0))
	return;
I forgot you have to put an if over the

Code: Select all

delete m_pAppStateManager;
in DemoApp::~DemoApp() because if it cancels before

Code: Select all

m_pAppStateManager = new AppStateManager();
is called it will give an error.

Code: Select all

if(m_pAppStateManager)
{
      delete m_pAppStateManager;
}
dave2041
Halfling
Posts: 71
Joined: Fri Apr 24, 2009 12:55 pm

Re: New wiki article: Advanced Ogre Framework

Post by dave2041 »

I love you project but i can't get it going. Not sure what version of ogre i'm using (probably the problem) but it throws up this:

Error 1 error C2039: 'setMaterial' : is not a member of 'Ogre::SubEntity' \ogre\gamestate.cpp 251
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 135
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by spacegaier »

Well, you just try to find out and in any case use a current one (1.6.x). Ogre 1.7 should also be fine, but it's not stable yet.
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 »

do you think the ogre version is the problem? i haven't been using it for that long (since april) so i doubt its an old old version ~
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 135
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by spacegaier »

Well, this is strange. The online API version doesn't mention this setMaterial() function as well, but in the version here is one (and noone has ever reported anything else here) :shock:

EDIT: But Ogre trunk has this function as well...
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 »

hmmm. installed 1.6.4 and get linking errors regarding tinyxml.

Code: Select all

Error	9	error LNK2019: unresolved external symbol "public: __thiscall TiXmlDocument::TiXmlDocument(void)" (??0TiXmlDocument@@QAE@XZ) referenced in function "public: void __thiscall Ogre::DotSceneLoader::parseDotScene(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class Ogre::SceneManager *,class Ogre::SceneNode *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?parseDotScene@DotSceneLoader@Ogre@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0PAVSceneManager@2@PAVSceneNode@2@0@Z)	DotSceneLoader.obj
Error	10	error LNK2019: unresolved external symbol "public: class TiXmlElement const * __thiscall TiXmlNode::FirstChildElement(void)const " (?FirstChildElement@TiXmlNode@@QBEPBVTiXmlElement@@XZ) referenced in function "public: class TiXmlElement * __thiscall TiXmlNode::FirstChildElement(void)" (?FirstChildElement@TiXmlNode@@QAEPAVTiXmlElement@@XZ)	DotSceneLoader.obj
Error	11	error LNK2019: unresolved external symbol "public: char const * __thiscall TiXmlElement::Attribute(char const *)const " (?Attribute@TiXmlElement@@QBEPBDPBD@Z) referenced in function "protected: void __thiscall Ogre::DotSceneLoader::processScene(class TiXmlElement *)" (?processScene@DotSceneLoader@Ogre@@IAEXPAVTiXmlElement@@@Z)	DotSceneLoader.obj
Error	12	error LNK2019: unresolved external symbol "public: class TiXmlElement const * __thiscall TiXmlNode::FirstChildElement(char const *)const " (?FirstChildElement@TiXmlNode@@QBEPBVTiXmlElement@@PBD@Z) referenced in function "public: class TiXmlElement * __thiscall TiXmlNode::FirstChildElement(char const *)" (?FirstChildElement@TiXmlNode@@QAEPAVTiXmlElement@@PBD@Z)	DotSceneLoader.obj
Error	13	error LNK2019: unresolved external symbol "public: class TiXmlElement const * __thiscall TiXmlNode::NextSiblingElement(char const *)const " (?NextSiblingElement@TiXmlNode@@QBEPBVTiXmlElement@@PBD@Z) referenced in function "public: class TiXmlElement * __thiscall TiXmlNode::NextSiblingElement(char const *)" (?NextSiblingElement@TiXmlNode@@QAEPAVTiXmlElement@@PBD@Z)	DotSceneLoader.obj
Although i did just copy the headers from the tinyxml download folder...
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 135
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by spacegaier »

Okay, this setMaterial(MaterialPtr) was added Sun Jan 18 11:53:24 2009 according to the SVN repository.

Well obivoulsy this seems to work now with 1.6.4 :)

These new errors indicate that you don't link to the tinyXml LIB files. You have to add them in your IDE settings then everything should be fine.
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 »

linked in the LIB and now on execution "The application failed to initialize properly (0x0150002).

hmmmmm :(

P.S. theres only one LIB from tinyxml i need right? (tinyxmld.lib)
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 135
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by spacegaier »

All those LIBs need to be linked to:

Code: Select all

OgreMain.lib
OIS.lib
CEGUIBase.lib
OgreGUIRenderer.lib
tinyxml.lib
What does the Ogre.log say? Do you try to load a file somewhere that isn't where Ogre expects it to be?
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 »

sounds insane but i don't think SP1 is installed :S googled that error and someone else on this forum had the same error. VERY strange as i use ogre all the time not had a problem... Will check if sp1 is installed though. And yes have those lib's linked as well :)

Ogre doesn't get far enough to make a log!

UPDATE: just ran the sp1 installer and it says i have sp1 installed already, so i guess thats not it ><

How frustrating lol, oh well i'll have a sleep on it. Very tired and have a tooth ache :( ty for your help :)
dave2041
Halfling
Posts: 71
Joined: Fri Apr 24, 2009 12:55 pm

Re: New wiki article: Advanced Ogre Framework

Post by dave2041 »

WOW how annoying, nothing compiles properly now ><

Can't figure it out, with the old ogresdk folder it says setMaterialNAme is not a property... change to the new ogreSDK and it has that error about initializing.

none of my old projects run using the new sdk either, all have the same error. :(

Output:

Code: Select all

'Ogre.exe': Loaded 'C:\Users\David\Desktop\Ten Robot's Wandering - Copy\Ogre\bin\debug\Ogre.exe', Symbols loaded.
'Ogre.exe': Loaded 'C:\Windows\System32\ntdll.dll', No symbols loaded.
'Ogre.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', No symbols loaded.
'Ogre.exe': Loaded 'C:\Users\David\Desktop\Ten Robot's Wandering - Copy\Ogre\bin\debug\OgreMain_d.dll', No symbols loaded.
Debugger:: An unhandled non-continuable exception was thrown during process load
The program '[3052] Ogre.exe: Native' has exited with code -1072365566 (0xc0150002).
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 135
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by spacegaier »

You recompiled your application again just to be sure? And you are linking against the correct LIB and DLLs files (Debug as far as I can tell from your Output)?

If you set a break point at the earliest possible line of your program, is it reached or does it crash before?
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 »

doesn't hit the breakpoint. linked to the correct lib's and dll's afaik :(
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 135
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by spacegaier »

But this problem is not specific to my Framerwork, but applies to all your Ogre application currently?
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 »

well yes, with my older ogresdk folder all my projects are fine. with the new one your project gets the "getmaterialname function doesn't exist" error and none of my projects work (whether i rebuild/compile etc or not)
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 135
Contact:

Re: New wiki article: Advanced Ogre Framework

Post by spacegaier »

Okay, are you sure you are linking to the current Ogre version you downloaded (and only to this). Did you totally remove the old SDK?

If yes, start a new empty project, with this code (once Ogre runs in general again on your machine, we can sort out the Framework specific things):

Code: Select all

#include <Ogre.h>

int main(int argc, char* argv[])
{
    Ogre::Root* root = new Ogre::Root("plugins.cfg","ogre.cfg","Ogre.log");
    delete root;
    return 0;
}
That is just the minimal Ogre test code. Link it to OgreMain.lib and put the OgreMain.dll in the application folder an tell me if it runs :) .
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 »

ok runs with the old ogreSDK but not the new one! (once compiled i copied the executable from debug to the bin/debug in each ogresdk)

:S tried reinstalling the SDK to no avail

from ogre.log incase it helps:
12:38:19: *-*-* Version 1.6.0 (Shoggoth)
Post Reply