New wiki article: Basic Ogre Framework

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

Re: New wiki article: BasicOgreFramework

Post by spacegaier »

I have the name of my scene manager, but I don't know whether this will be that nice.

Just to clear that up: You would advise me to remove as many members from OgreFramework as possible even if that makes the code more complicated to read? So use things like that:

Code: Select all

Ogre::LogManager::getSingleton().getLog("OgreLogfile")->logMessage("OgreFramework::keyPressed");
Ogre::Root::getSingleton().getSceneManager("SceneManager")->getCamera("Camera")->setPolygonMode(PM_WIREFRAME);
m_pCubeNode = Ogre::Root::getSingleton().getSceneManager("SceneManager")->getRootSceneNode()->createChildSceneNode("CubeNode");
Should I then create string members to store all the names of the SceneManager, the Camera, the Log, ...?
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...
Speedo
Greenskin
Posts: 106
Joined: Fri Jan 23, 2009 9:17 pm

Re: New wiki article: BasicOgreFramework

Post by Speedo »

Just to clear that up: You would advise me to remove as many members from OgreFramework as possible even if that makes the code more complicated to read? So use things like that:
-IMO-

Neither solution is "perfect". One will require you to pass around a lot of pointer or references. The other will require lookups such as the code you posted. Generally, I don't see it being much more than a preference of style. I just happen to prefer the latter.
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4308
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 137

Re: New wiki article: BasicOgreFramework

Post by spacegaier »

Yeah...you are right. It's mostly a matter of style and one's preferences. Therefore, I'll leave it with the member variables.

EDIT: I added a note in the article concerning this topic.
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
Pyritie
Gnome
Posts: 363
Joined: Wed Feb 25, 2009 6:15 pm
Location: UK
x 8

Re: New wiki article: BasicOgreFramework

Post by Pyritie »

Umm, where is "m_pOgreFramework"? I can't find it declared anywhere. Maybe this is old code that wasn't removed?
I use Mogre, BulletSharp, LuaNetInterface, irrKlang, and Miyagi! | Ponykart (Showcase)
Image
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4308
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 137

Re: New wiki article: BasicOgreFramework

Post by spacegaier »

Damn, I thought that I changed it everywhere...

Yes, you are right. m_pOgreFramework isn't needed aymore (it was used in previous versions). Now, Ogre::Framework is a singleton and therefore can directly be accessed.
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
Pyritie
Gnome
Posts: 363
Joined: Wed Feb 25, 2009 6:15 pm
Location: UK
x 8

Re: New wiki article: BasicOgreFramework

Post by Pyritie »

Ah, that explains why then.
I use Mogre, BulletSharp, LuaNetInterface, irrKlang, and Miyagi! | Ponykart (Showcase)
Image
User avatar
Pyritie
Gnome
Posts: 363
Joined: Wed Feb 25, 2009 6:15 pm
Location: UK
x 8

Re: New wiki article: BasicOgreFramework

Post by Pyritie »

I fixed a little typo.

Also, Ogre::WindowEventUtilities::messagePump(); (in DemoApp::runGame()) doesn't compile for me.
I use Mogre, BulletSharp, LuaNetInterface, irrKlang, and Miyagi! | Ponykart (Showcase)
Image
User avatar
mikeInside
Kobold
Posts: 37
Joined: Thu Apr 26, 2007 5:46 pm
Location: Sydney, Australia

Re: New wiki article: BasicOgreFramework

Post by mikeInside »

Exactly what I was looking for. Thanks muchly! :D
Last edited by mikeInside on Fri Apr 24, 2009 2:02 pm, edited 1 time in total.
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4308
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 137

Re: New wiki article: BasicOgreFramework

Post by spacegaier »

You're welcome. Always nice to get some positive feedback :) !
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

Re: New wiki article: BasicOgreFramework

Post by spacegaier »

Instead of this Ogre::WindowEventUtilities::messagePump() function, try this:

Code: Select all

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
{
	MSG msg;
	while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) 
	{
		 if (msg.message == WM_QUIT)
			 m_bShutdown = true;
		 else 
		 {
			 TranslateMessage(&msg);
			 DispatchMessage(&msg);
		 }
	}
}
#endif	
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
Pyritie
Gnome
Posts: 363
Joined: Wed Feb 25, 2009 6:15 pm
Location: UK
x 8

Re: New wiki article: BasicOgreFramework

Post by Pyritie »

Well, that got rid of that problem yes.

Although now this won't compile: OgreFramework* Ogre::Singleton<class OgreFramework>::ms_Singleton = 0;

Code: Select all

..\src\OgreFramework.cpp:8: error: too few template-parameter-lists
..\src\OgreFramework.cpp: In member function `void OgreFramework::initOgre(Ogre::String, OIS::KeyListener*, OIS::MouseListener*)':
..\src\OgreFramework.cpp:53: warning: unused variable 'logMgr'
Did you even try compiling this yourself :o? You're missing a namespace/haven't put Ogre:: in front of things, not to mention several other things like that.
I use Mogre, BulletSharp, LuaNetInterface, irrKlang, and Miyagi! | Ponykart (Showcase)
Image
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4308
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 137

Re: New wiki article: BasicOgreFramework

Post by spacegaier »

Yes, I compiled it (there is even a link to a out-of-the-box running version). Works perfectly for me.

If I should have forgotten to insert a Ogre:: somewhere, I'd be happy if you change it in the wiki.

For the problem with the singleton: I have no clue where this problem comes from.

EDIT: Which Ogre version are you using?

EDIT II: What are these "other things" that doesn't work you are making allusion to?
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
Pyritie
Gnome
Posts: 363
Joined: Wed Feb 25, 2009 6:15 pm
Location: UK
x 8

Re: New wiki article: BasicOgreFramework

Post by Pyritie »

Well, I was using an older version, which is what the problem was. Looked at the latest version and the "other things" were already fixed. My bad.

I'm using Shoggoth or whatever the latest release one is (not SVN), compiling with mingw.
I use Mogre, BulletSharp, LuaNetInterface, irrKlang, and Miyagi! | Ponykart (Showcase)
Image
User avatar
Pyritie
Gnome
Posts: 363
Joined: Wed Feb 25, 2009 6:15 pm
Location: UK
x 8

Re: New wiki article: BasicOgreFramework

Post by Pyritie »

I use Mogre, BulletSharp, LuaNetInterface, irrKlang, and Miyagi! | Ponykart (Showcase)
Image
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4308
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 137

Re: New wiki article: BasicOgreFramework

Post by spacegaier »

Thanks for the link. I changed it in the wiki as well as in the version, I've uploaded to run out-of-the-box. Glad that everything works fine now.

Could you tell me which older version you were using? Then I could at least add a note in the article or even try to find a workaround.
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
Pyritie
Gnome
Posts: 363
Joined: Wed Feb 25, 2009 6:15 pm
Location: UK
x 8

Re: New wiki article: BasicOgreFramework

Post by Pyritie »

Nah, I was using an older version of the framework, where you had things like PPOINT instead of PM_POINT and so on. That's all. :P
I use Mogre, BulletSharp, LuaNetInterface, irrKlang, and Miyagi! | Ponykart (Showcase)
Image
PC_Nerd
Halfling
Posts: 55
Joined: Thu May 08, 2008 9:23 am
Location: Sydney

Re: New wiki article: BasicOgreFramework

Post by PC_Nerd »

Hi,

When I build the code in the tutorial, it works fine.. however whenever I press the ESC key the mouse returns to normal use ( as in its not captured by OIS anymore)... however the application window stays there and cannot be shutdown normall ( I have to end the proccess).

Im running ubuntu 8.04, and the latest SVN from branches/v1-6. Any suggestions as to why this might be?
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4308
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 137

Re: New wiki article: BasicOgreFramework

Post by spacegaier »

Hmm...my first guess would be that this has something to do with Ubuntu, but honestly: I don't know.

Does this also happen when you run the .exe I compiled and uploaded (link is in one of the first green boxes in the article)?

EDIT: Found this thread. Perhaps it helps...
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...
PC_Nerd
Halfling
Posts: 55
Joined: Thu May 08, 2008 9:23 am
Location: Sydney

Re: New wiki article: BasicOgreFramework

Post by PC_Nerd »

Hi,

I read through the other post and didnt really spot anything that it could be. I've checked the version of ois here, and the package manager says its "0.99+1.0rc1-2.1"... I'm going to download ois from souce and see if that will change anything ( I think the latest is 1.4 or something isnt it?)...

Some of the examples (as in based off ExampleApplication.h instead of this new framework) dont work - but they have a different issue (on load up they quit though I havent had time to read through the logs etc).

do you think that building ois from source could fix it ( because I dont want to if I dont have to).
Thanks!
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4308
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 137

Re: New wiki article: BasicOgreFramework

Post by spacegaier »

Well, honestly: I don't now.

Do the Ogre samples work for you? And did you check my uploaded version as proposed in my post 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...
PC_Nerd
Halfling
Posts: 55
Joined: Thu May 08, 2008 9:23 am
Location: Sydney

Re: New wiki article: BasicOgreFramework

Post by PC_Nerd »

I mentioned in my previous post that some of the samples dont work - however they fail on a different error.... and I cannot run your exe...... exe=windoze (though I tried wine and no success (wouldnt run full stop so different issue altogether)....


I'll try the different OIS later today.
Thanks
User avatar
mikeInside
Kobold
Posts: 37
Joined: Thu Apr 26, 2007 5:46 pm
Location: Sydney, Australia

Re: New wiki article: BasicOgreFramework

Post by mikeInside »

Hi again! I can run the sample fine, but when I try compiling it myself and then running it, it shuts down after the configdialog. :(
I tried compiling against 1.6.0 and 1.6.1, and using directx and opengl, all give the same problem:

with DX:

Code: Select all

....13:31:35:    - Max vertex textures: 4
13:31:35:    - Vertex textures shared: no
13:31:35:  * Render to Vertex Buffer : no
13:31:35:  * DirectX per stage constants: yes
13:31:35: ***************************************
13:31:35: *** D3D9 : Subsystem Initialised OK ***
13:31:35: ***************************************
13:31:35: ResourceBackgroundQueue - threading disabled
13:31:35: Particle Renderer Type 'billboard' registered
CRASH!
with GL:

Code: Select all

...13:32:00:  * GL 1.5 without VBO workaround: no
13:32:00:  * Frame Buffer objects: yes
13:32:00:  * Frame Buffer objects (ARB extension): no
13:32:00:  * Frame Buffer objects (ATI extension): no
13:32:00:  * PBuffer suppport: no
13:32:00:  * GL 1.5 without HW-occlusion workaround: no
13:32:00: Registering ResourceManager for type Texture
13:32:00: ResourceBackgroundQueue - threading disabled
13:32:00: Particle Renderer Type 'billboard' registered
CRASH!
Usually after registering the billboard, it should parse resource.cfg and create the 'bootstrap' resource group, so I guess that is where it is crashing... but I have no idea why. Any thoughts?
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4308
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 137

Re: New wiki article: BasicOgreFramework

Post by spacegaier »

Where exactly does it crash? Did you check that resource.cfg and all the resources are correct (so that the problem can't be caused by them)?
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
mikeInside
Kobold
Posts: 37
Joined: Thu Apr 26, 2007 5:46 pm
Location: Sydney, Australia

Re: New wiki article: BasicOgreFramework

Post by mikeInside »

Got it up and running. Seeing that big ugly ogre head was such a welcome sight hehe. I overwrote the included dll files with fresh ones from the ogre1.6.1 sdk, and that did the trick. I guess they were from a different version of ogre. This was probably a silly oversight on my part... still a bit new to this. Anyways I'm looking forward to playing around with this framework, thanks again!
User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1894
Joined: Sun Mar 08, 2009 5:25 am
x 116

Re: New wiki article: BasicOgreFramework

Post by mkultra333 »

Hi, just looking at the framework now. Glad there was something like this around, the tutes all use ExampleFramework, and I came away from them clueless as to how to handle resources and such. Something like this, where it's all out in the open, is much better. The only tute that came close was Tute 6, but it goes to the other extreme and doesn't give you anything to work with.

To make things easier, you might change some of the includes, to save people having to add more stuff to the directory paths. Instead of #include <OISEvents.h>, #include <OIS/OISEvents.h> would be better since I already had the ogre includes folder set but not the specific OIS sub-folder.

I constantly get a garbage figure for my "worst fps" readout, it says my worst fps is 2.3831e-007 4294967157ms. None of the other demo apps or tutorials print such a bizarre value. What's causing this, and how can I fix it?

Edit: After looking through the API, I tried adding a call to resetStatistics() to the runDemo() function, just above the main while loop. Seems to have fixed the weird "worst fps" number, hopefully this is the correct way.
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.