Dark Bit Factory & Gravity
GENERAL => Projects => Topic started by: Rbz 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.
-
- Approx. 72 fps
- System OK
- But the spinning cube is on exctasy.
-
Do you mean it was spinning too fast ?
-
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.
-
hmm, Ok Benny! thanks a lot for your fast response :)
I'll keep working on it
-
Exactly the same here. 60Hz, but the cube is going crazy. Just like the scrolly.
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
-
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.
-
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);
//---------------------------------------------------------------------
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..
-
I get 75 fps and System OK on the new one. Seems to work fine.
-
It's still not working right here. :(
-
Works great now !!! Well done !!!
-
Rbraz:
61 fps, system ok, cube going mental...unwatchably fast.
ATI x600 laptop.
-
I'm getting up to 180fps, system OK, cube spinning perfectly.
Intel Centrio Duo 1.83ghz.
-
my Office MAchine P4 2.8G Built in shit gfx = 120fps and looks just fine here.
-
I found some problems in the code, changed "LastTickCount" and "HTimerFreq" to float variables.
Can you test it again, plz :)
-
@rbraz:
Still runs perfect on my machine !!!
-
My full monitors refresh rate dude of 75fps.
-
thx dudes :)
-
Still runs the same here on my orafice machine :||
-
Now it's working!
The only difference between this PC and home now is that this PC says 60fps and home says 500+fps. But both are drawing at the right rate.
Karma+ for sticking with it!
Jim
-
@wham: thanks mate
@Jim: Cool, of course with your help :cheers: