frames per second = 1 / (seconds per frame)
codeka.com - Just click it.
Time recording for fps system - how to?
I allready tried that:
(int)((float)1/(float)framerate)
But it gives 0 no matter what...
-------------
E-)mil
http://eej.dk
- Just another crazy dane
(int)((float)1/(float)framerate)
But it gives 0 no matter what...
-------------
E-)mil
http://eej.dk
- Just another crazy dane
#include
#pragma comment(lib,"winmm.lib")
DWORD g_dwFrameRate = 0; // FPS you want
DWORD g_dwLastTickCount = 0;
DWORD g_dwFrameCount = 0;
timeBeginPeriod(1);
g_dwFrameCount++;
if (abs(timeGetTime() - g_dwLastTickCount) >= 1000)
{
g_dwLastTickCount = timeGetTime();
g_dwFrameRate = g_dwFrameCount;
g_dwFrameCount = 0;
}
timeEndPeriod(1);
#pragma comment(lib,"winmm.lib")
DWORD g_dwFrameRate = 0; // FPS you want
DWORD g_dwLastTickCount = 0;
DWORD g_dwFrameCount = 0;
timeBeginPeriod(1);
g_dwFrameCount++;
if (abs(timeGetTime() - g_dwLastTickCount) >= 1000)
{
g_dwLastTickCount = timeGetTime();
g_dwFrameRate = g_dwFrameCount;
g_dwFrameCount = 0;
}
timeEndPeriod(1);
>>Payne
Shure - shure - why should that be better than the other method, and how do i calculate the fps value here?
Would u comment it please?
-------------
E-)mil
http://eej.dk
- Just another crazy dane
Shure - shure - why should that be better than the other method, and how do i calculate the fps value here?
Would u comment it please?
-------------
E-)mil
http://eej.dk
- Just another crazy dane
seem my timeGetTime run at 1000 ticks per second,
should it be 1024? i wonder.........
whatever timeGetTime or timeGetTime,
fps = 1000/(currentframetick-lastframetick)
and that is, u have ur fps every frame.
should it be 1024? i wonder.........
whatever timeGetTime or timeGetTime,
fps = 1000/(currentframetick-lastframetick)
and that is, u have ur fps every frame.
OK
// Global variables
DWORD g_dwFrameRate = 0; // FPS you want
DWORD g_dwLastTickCount = 0;
DWORD g_dwFrameCount = 0;
// Put the following lines after IDirect3DDevice:resent() method
timeBeginPeriod(1);
g_dwFrameCount++;
if (abs(timeGetTime() - g_dwLastTickCount) >= 1000)
{
g_dwLastTickCount = timeGetTime();
g_dwFrameRate = g_dwFrameCount;
g_dwFrameCount = 0;
char szText[22];
wsprintf(szText, "Frame Rate = %d fps", g_dwFrameRate);
SetWindowText(hWnd, szText);
}
timeEndPeriod(1);
// Global variables
DWORD g_dwFrameRate = 0; // FPS you want
DWORD g_dwLastTickCount = 0;
DWORD g_dwFrameCount = 0;
// Put the following lines after IDirect3DDevice:resent() method
timeBeginPeriod(1);
g_dwFrameCount++;
if (abs(timeGetTime() - g_dwLastTickCount) >= 1000)
{
g_dwLastTickCount = timeGetTime();
g_dwFrameRate = g_dwFrameCount;
g_dwFrameCount = 0;
char szText[22];
wsprintf(szText, "Frame Rate = %d fps", g_dwFrameRate);
SetWindowText(hWnd, szText);
}
timeEndPeriod(1);
Gah! Sorry, emileej... the proper fps conversion *should* be this:
This way, if a frame takes approx 17ms, it should give you a result of 60fps
Paradigm Shift 2000
float framespersecond = (float)(1000)/(float)(framerate);
This way, if a frame takes approx 17ms, it should give you a result of 60fps
Paradigm Shift 2000
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement