I was wondering if it was possible to make a program in visual basic
that could measure framerates in directx and opengl. Such as the
program "fraps" http://www.fraps.com
Any ideas,suggestions, or comments would be greatly appreciated.
Printable View
I was wondering if it was possible to make a program in visual basic
that could measure framerates in directx and opengl. Such as the
program "fraps" http://www.fraps.com
Any ideas,suggestions, or comments would be greatly appreciated.
Look up the Win32 API's GetTickCount function. That should let you do it easily.
that code should work, you need to declare the gettickcount api though
past that into your mainloop
Code:
global FPS as long
static FPStime as long
static frame as long
if FPStime +1000 < gettickcount
fps = frame
frame = 0
endif
frame = frame +1
Thanks for the help guys.. :D
Here is a better code fragment:
Z.Code:Dim STime as Long
Dim ETime as Lonh
...
STime = GetTickCount()
'// do drawing and updating here...
ETime = GetTickCount()
Dim fps as Single
fps = 1000 / (ETime-STime)
well the second will show you very different frame rates each time while the first one shows more average results.. I recommend (and use) the first one though
Thank you again. I have one more question. I was wanting to find the frames per second in any direct x or d3d game i had running, not just my vb program. any suggestions?
I'd say any 3D game supports showing the FPS rate.. in most cases you can directly show the rate on screen, in some games its logged in a log-file when exiting the game, differs... otherwise I don't see any way to get the FPS of running programs.