Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#Actuallonewolff

Posted 14 July 2012 - 02:54 AM

I still think it is to do with your timer. GetSystemTime() seems to be only accurate to the millisecond.

If you have a basic scene you might be rendering faster than 1000 fps, so your scene will be choppy as the timer wont be acurate enough.

On my 3 year old video card my application (that also uses sprites) is rendering at 8000 FPS. This is why I had the same problems that your are experiencing. I had to re-think my timer.

Give my timer a try Posted Image

#pragma once
class Timer
{
public:
Timer()
{
  liCurrent.QuadPart=0;
  liPrevious.QuadPart=0;
}
~Timer()
{
}
long double TimeSinceLastFrame()
{
  QueryPerformanceFrequency(&liPerfFreq);
  QueryPerformanceCounter(&liCurrent);
  ddFrameTime=(liCurrent.QuadPart-liPrevious.QuadPart)/long double(liPerfFreq.QuadPart)*1000;
  liPrevious.QuadPart=liCurrent.QuadPart;
  return ddFrameTime;
}
private:
LARGE_INTEGER liCurrent;
LARGE_INTEGER liPrevious;
LARGE_INTEGER liPerfFreq;
LARGE_INTEGER liStart;
long double ddFrameTime;
};
TimeSinceLastFrame() will return exactly that (but using the performance counters)

I would love to know how you go Posted Image

#1lonewolff

Posted 14 July 2012 - 02:54 AM

I still think it is to do with your timer. GetSystemTime() seems to be only accurate to the millisecond.

If you have a basic scene you might be rendering faster than 1000 fps, so your scene will be choppy as the timer wont be acurate enough.

On my 3 year old video card my application (that also uses sprites) is rendering at 8000 FPS. This is why I had the same problems that your are experiencing. I had to re-think my timer.

Gice my timer a try :)

#pragma once
class Timer
{
public:
 Timer()
 {
  liCurrent.QuadPart=0;
  liPrevious.QuadPart=0;
 }
 ~Timer()
 {
 }
 long double TimeSinceLastFrame()
 {
  QueryPerformanceFrequency(&liPerfFreq);
  QueryPerformanceCounter(&liCurrent);
  ddFrameTime=(liCurrent.QuadPart-liPrevious.QuadPart)/long double(liPerfFreq.QuadPart)*1000;
  liPrevious.QuadPart=liCurrent.QuadPart;
  return ddFrameTime;
 }
private:
 LARGE_INTEGER liCurrent;
 LARGE_INTEGER liPrevious;
 LARGE_INTEGER liPerfFreq;
 LARGE_INTEGER liStart;
 long double ddFrameTime;
};
TimeSinceLastFrame() will return exactly that (but using the performance counters)

I would love to know how you go :)

PARTNERS