Diapolo
05-02-2001, 09:35 AM
Hi all!
I calculate the current fps in the following way:
- measure time it takes to render a frame in ms and store it in a float array (fTime[5]) with an index variable iFrames
- do iFrames++ every time the function is called (everytime a frame is rendered)
- check if iFrames == 5
- if TRUE: divide 1000.00f (1 sec) with the average time it took to render a frame
- display the current float variable that holds the last framerate per second on the screen
1. Is this a good solution?
2. Should I average more than the last 5 rendered frames or is there too much overhead then?
3. Are there better ways?
4. Is there a function to average the float array (add all values and divide by the array size)?
Regards,
Diapolo
I calculate the current fps in the following way:
- measure time it takes to render a frame in ms and store it in a float array (fTime[5]) with an index variable iFrames
- do iFrames++ every time the function is called (everytime a frame is rendered)
- check if iFrames == 5
- if TRUE: divide 1000.00f (1 sec) with the average time it took to render a frame
- display the current float variable that holds the last framerate per second on the screen
1. Is this a good solution?
2. Should I average more than the last 5 rendered frames or is there too much overhead then?
3. Are there better ways?
4. Is there a function to average the float array (add all values and divide by the array size)?
Regards,
Diapolo