• Welcome to Dark Bit Factory & Gravity.
 

Delta Time test

Started by Rbz, February 06, 2007

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

Rbz

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.



Challenge Trophies Won:

benny!

- 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:

Rbz

Do you mean it was spinning too fast ?
Challenge Trophies Won:

benny!

Quote from: rbraz 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:

Rbz

hmm, Ok Benny! thanks a lot for your fast response  :)

I'll keep working on it
Challenge Trophies Won:

Jim

Exactly the same here.  60Hz, but the cube is going crazy.  Just like the scrolly.

Jim
Challenge Trophies Won:

Jim

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:

Clyde

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:

Rbz

#8
Quote from: Jim 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

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

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:

    //----------------------------- 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);
    //---------------------------------------------------------------------


Quote from: Clyde 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.
Thanks Clyde, but it was bugged on some PC's..




Challenge Trophies Won:

rdc

I get 75 fps and System OK on the new one. Seems to work fine.

Jim

It's still not working right here. :(
Challenge Trophies Won:

benny!

Works great now !!! Well done !!!
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

taj

Rbraz:

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

ATI x600 laptop.
Challenge Trophies Won:

Shockwave

I'm getting up to 180fps, system OK, cube spinning perfectly.

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

Ghost^BHT

my Office MAchine P4 2.8G Built in shit gfx  = 120fps and looks just fine here.

Rbz

I found some problems in the code, changed "LastTickCount" and "HTimerFreq" to float variables.

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

benny!

@rbraz:

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

Challenge Trophies Won:

Clyde

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:

Rbz

Challenge Trophies Won:

Ghost^BHT

Still runs the same here on my orafice machine   :||