class someClass : public Ogre::FrameListener
{
bool frameStarted(FrameEvent &evt);
bool frameEnded(FrameEvent &evt);
};
bool someClass::frameStarted(FrameEvent &evt)
{
//do what u like to be done before rendering
return true;
}
bool someClass::frameEnded(FrameEvent &evt)
{
//do what u like to be done after rendering
return true;
}
edit:
the function frameStarted and frameEnded will be called automatically, if u have registered the framelistener with Ogre. I think u have to do something like this:
Generally, you don't have to worry about Ogre doing it's magic - after Root::startRendering() it happens automatically.
For your own stuff, you can use framelisteners to execute code on a frame by frame basis.
That can be input, AI, etc.
Forget about renderOneFrame(), etc. The only time when you want to update the renderloop manually, is when writing gui tools (MFC for instance).
Feel free to search around for more on this subject - there's a lot on that in the Ogre fora.
/* Less noise. More signal. */ Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion. OgreAddons - the Ogre code suppository.
[quote="jacmoe"]Forget about renderOneFrame(), etc. The only time when you want to update the renderloop manually, is when writing gui tools (MFC for instance).quote]
That's not entirely true, if you're writing a framework independant of Ogre you'll need to use renderOneFrame() in your own loop
I take it that you dont want to use the Ogre::Root::startRendering and Ogre::Framelistener's and manually make your own game loop ?!?
In that case it would be most correct to render something after you've done your logic and simulating of the world it would be more natural to render what you have in the current step/"world state" and not the previous step. So yes this means that you will have a loop that loops somethink like this: