Author Topic: Delta Time test  (Read 9384 times)

0 Members and 1 Guest are viewing this topic.

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Delta Time test
« on: February 06, 2007 »
I'm working on delta time function using winapi  "QueryPerformanceCounter" and wondering if you can test it for me.
If everything is fine you will see a FPS counter, "Sytem OK" and a spinning cube, if not, an error message will appear.

Any feedback will be much appreciated, thanks.



« Last Edit: February 07, 2007 by rbraz »
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Delta Time test
« Reply #1 on: February 06, 2007 »
- Approx. 72 fps
- System OK
- But the spinning cube is on exctasy.
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: Delta Time test
« Reply #2 on: February 06, 2007 »
Do you mean it was spinning too fast ?
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Delta Time test
« Reply #3 on: February 06, 2007 »
Do you mean it was spinning too fast ?

Yup. Sorry to say that. But it is like the scroller. Way too fast. It's nearly just
flickering. You cannot really see that the cube is spinning.
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: Delta Time test
« Reply #4 on: February 06, 2007 »
hmm, Ok Benny! thanks a lot for your fast response  :)

I'll keep working on it
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Delta Time test
« Reply #5 on: February 06, 2007 »
Exactly the same here.  60Hz, but the cube is going crazy.  Just like the scrolly.

Jim
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Delta Time test
« Reply #6 on: February 06, 2007 »
I can see you're calling the drawing code in WM_PAINT, how is that message generated?  Also, you're not using QueryPerformanceFrequency().  Without that, QueryPerformanceCounter() isn't any use because you don't knwo how fast it's ticking.  Right now you're just dividing by 1000.

Jim
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Delta Time test
« Reply #7 on: February 07, 2007 »
The cube is spinning nicely on my Geforce FX5500, this must be a gfx card issue. And my fps read is 74fps and system ok.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: Delta Time test
« Reply #8 on: February 07, 2007 »
I can see you're calling the drawing code in WM_PAINT, how is that message generated?  Also, you're not using QueryPerformanceFrequency().  Without that, QueryPerformanceCounter() isn't any use because you don't knwo how fast it's ticking.  Right now you're just dividing by 1000.

Jim

Thanks a lot Jim, I guess the problem is solved, I was ignoring the "QueryPerformanceFrequency" that return diferents results for each computer, dividing "QueryPerformanceCounter" by 1000 is completely wrong  :-[

Here you will find some nice info about timing -> http://www.geisswerks.com/ryan/FAQS/timing.html

Code: [Select]
void Set_Frames_Counter()
{
QueryPerformanceFrequency(&HTimerVal);
HTimerFreq = HTimerVal.QuadPart;   
QueryPerformanceCounter(&HTimerVal);
LastTickCount = HTimerVal.QuadPart;
}

float Get_Frames_Delay()
{
float delay;

QueryPerformanceCounter(&HTimerVal);
delay = (float)((HTimerVal.QuadPart - LastTickCount)/HTimerFreq);
LastTickCount = (int)HTimerVal.QuadPart;

return delay;
}


Fixed the main loop, I'm using this now:

Code: [Select]
    //----------------------------- Main Loop ------------------------------
do
{
if(PeekMessage(&msg,hWnd,0,0,PM_REMOVE) != 0)
{
// translate and dispatch
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
// Update and Draw OGL scene
glUpdate(Get_Frames_Delay());
glDraw();
SwapBuffers ( hDC );
}

}while(msg.message != WM_QUIT);
    //---------------------------------------------------------------------

The cube is spinning nicely on my Geforce FX5500, this must be a gfx card issue. And my fps read is 74fps and system ok.
Thanks Clyde, but it was bugged on some PC's..




« Last Edit: February 07, 2007 by rbraz »
Challenge Trophies Won:

Offline rdc

  • Pentium
  • *****
  • Posts: 1495
  • Karma: 140
  • Yes, it is me.
    • View Profile
    • Clark Productions
Re: Delta Time test
« Reply #9 on: February 07, 2007 »
I get 75 fps and System OK on the new one. Seems to work fine.

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Delta Time test
« Reply #10 on: February 07, 2007 »
It's still not working right here. :(
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Delta Time test
« Reply #11 on: February 07, 2007 »
Works great now !!! Well done !!!
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Delta Time test
« Reply #12 on: February 07, 2007 »
Rbraz:

61 fps, system ok, cube going mental...unwatchably fast.

ATI x600 laptop.
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Delta Time test
« Reply #13 on: February 07, 2007 »
I'm getting up to 180fps, system OK, cube spinning perfectly.

Intel Centrio Duo 1.83ghz.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Ghost^BHT

  • Clueless and Happy
  • ^GVY
  • Pentium
  • ******
  • Posts: 931
  • Karma: 49
  • BYTE ME!
    • View Profile
Re: Delta Time test
« Reply #14 on: February 07, 2007 »
my Office MAchine P4 2.8G Built in shit gfx  = 120fps and looks just fine here.

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: Delta Time test
« Reply #15 on: February 07, 2007 »
I found some problems in the code, changed "LastTickCount" and "HTimerFreq" to float variables.

Can you test it again, plz  :)
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Delta Time test
« Reply #16 on: February 07, 2007 »
@rbraz:

Still runs perfect on my machine !!!
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Delta Time test
« Reply #17 on: February 07, 2007 »
My full monitors refresh rate dude of 75fps.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: Delta Time test
« Reply #18 on: February 07, 2007 »
thx dudes  :)
Challenge Trophies Won:

Offline Ghost^BHT

  • Clueless and Happy
  • ^GVY
  • Pentium
  • ******
  • Posts: 931
  • Karma: 49
  • BYTE ME!
    • View Profile
Re: Delta Time test
« Reply #19 on: February 08, 2007 »
Still runs the same here on my orafice machine   :||