Results 1 to 8 of 8

Thread: Frames per second

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2002
    Posts
    3

    Frames per second

    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.

  2. #2
    Hyperactive Member
    Join Date
    Apr 1999
    Location
    New Jersey
    Posts
    334
    Look up the Win32 API's GetTickCount function. That should let you do it easily.

  3. #3
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    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
    Sanity is a full time job

    Puh das war harter Stoff!

  4. #4

    Thread Starter
    New Member
    Join Date
    Feb 2002
    Posts
    3
    Thanks for the help guys..

  5. #5
    Zaei
    Guest
    Here is a better code fragment:
    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)
    Z.

  6. #6
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    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

  7. #7

    Thread Starter
    New Member
    Join Date
    Feb 2002
    Posts
    3

    thx again

    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?

  8. #8
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width