TimeSinceLastFrame when not using framelisteners...possible?
- LordMyth
- Gremlin
- Posts: 181
- Joined: Thu Jan 06, 2005 10:19 pm
- Location: Belgium
- Contact:
TimeSinceLastFrame when not using framelisteners...possible?
Is it possible to get the time since the last frame if you don't use framelisteners?
Have a kiss from me!
Gentoo Linux on AMD64 3200+
NForce4 Chipset
Dual Channel DDR 2x512MB
PCX 16 GeForce 6600 256MB
Gentoo Linux on AMD64 3200+
NForce4 Chipset
Dual Channel DDR 2x512MB
PCX 16 GeForce 6600 256MB
- johnhpus
- Platinum Sponsor

- Posts: 1186
- Joined: Sat Apr 17, 2004 2:49 am
- x 3
I'm not sure but it seems possible. In a quick look this was the closest I could find " RenderWindow::getStatistics() " which returns a struct FrameStatistics. No exact time since last frame though.
I question why you would want to not use a frame listener.
Also, it occurs to me that if your not using a frame listener that your manually telling Ogre to render. If that's so just store get the time from the system yourself and it should very easy to figure out the time since last frame.
good luck
John
I question why you would want to not use a frame listener.
Also, it occurs to me that if your not using a frame listener that your manually telling Ogre to render. If that's so just store get the time from the system yourself and it should very easy to figure out the time since last frame.
good luck
John
- LordMyth
- Gremlin
- Posts: 181
- Joined: Thu Jan 06, 2005 10:19 pm
- Location: Belgium
- Contact:
Yeah, but getting the time from the system is a bit eh.. system specific... I knew how to do it in SDL, But I don't want to compile Ogre in SDL you know... I'll look at your getStatistics();
Have a kiss from me!
Gentoo Linux on AMD64 3200+
NForce4 Chipset
Dual Channel DDR 2x512MB
PCX 16 GeForce 6600 256MB
Gentoo Linux on AMD64 3200+
NForce4 Chipset
Dual Channel DDR 2x512MB
PCX 16 GeForce 6600 256MB
- LordMyth
- Gremlin
- Posts: 181
- Joined: Thu Jan 06, 2005 10:19 pm
- Location: Belgium
- Contact:
It is not for what I want, it returns the average, best, worst, and another thing framerates. Bu if OGRE calculates all these, it must have a Time since last frame variable eh? Because the way I make my app makes it hard to use frame listeners (segmentation faults etc...) and also, like Robomaniac says: more control (at least the feeling of it)
Have a kiss from me!
Gentoo Linux on AMD64 3200+
NForce4 Chipset
Dual Channel DDR 2x512MB
PCX 16 GeForce 6600 256MB
Gentoo Linux on AMD64 3200+
NForce4 Chipset
Dual Channel DDR 2x512MB
PCX 16 GeForce 6600 256MB
- sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
- Contact:
- LordMyth
- Gremlin
- Posts: 181
- Joined: Thu Jan 06, 2005 10:19 pm
- Location: Belgium
- Contact:
- Emmeran
- Goblin
- Posts: 272
- Joined: Wed Jun 02, 2004 11:47 am
- Location: Erlangen
- Contact:
Just take a timer and try something like this:
Code: Select all
Timer* mTimer = PlatformManager::getSingleton().createTimer();
long mLastFrame = 0;
float deltaT = 0.0f;
bool mStop;
(...)
mTimer->reset();
while(!mStop)
{
mSceneMgr->renderOneFrame();
// let's call the time since last frame in seconds deltaT:
deltaT = (mTimer->getMilliseconds() - mLastFrame) / 1000.0f;
(...)
mLastFrame = mTimer->getMilliseconds();
}
- LordMyth
- Gremlin
- Posts: 181
- Joined: Thu Jan 06, 2005 10:19 pm
- Location: Belgium
- Contact:
- LordMyth
- Gremlin
- Posts: 181
- Joined: Thu Jan 06, 2005 10:19 pm
- Location: Belgium
- Contact:
Thanks it worked but I did it like this (I think it's better then what you did):
Code: Select all
while (1) {
Timer->reset();
//Do something
TimeSinceLastFrame = Timer->getMilliseconds()/1000;
}Have a kiss from me!
Gentoo Linux on AMD64 3200+
NForce4 Chipset
Dual Channel DDR 2x512MB
PCX 16 GeForce 6600 256MB
Gentoo Linux on AMD64 3200+
NForce4 Chipset
Dual Channel DDR 2x512MB
PCX 16 GeForce 6600 256MB
- Emmeran
- Goblin
- Posts: 272
- Joined: Wed Jun 02, 2004 11:47 am
- Location: Erlangen
- Contact:
- LordMyth
- Gremlin
- Posts: 181
- Joined: Thu Jan 06, 2005 10:19 pm
- Location: Belgium
- Contact:
- Emmeran
- Goblin
- Posts: 272
- Joined: Wed Jun 02, 2004 11:47 am
- Location: Erlangen
- Contact: