Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. waiting for a small amount of time

waiting for a small amount of time

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsperformancehelpquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alex Griffing
    wrote on last edited by
    #1

    I would like to show graphics at a fixed 30 fps. The only solution I have is: while (true) { while (not ready) { check the performance timer() } draw() } The problem is that this method pegs the cpu. I would like to use one of these: - SetTimer and handle WM_TIMER - use WaitForSingleObject with a WaitableTimer possibly but they have too low a resolution. Can anyone see another solution? Thanks, Alex Griffing

    C J 2 Replies Last reply
    0
    • A Alex Griffing

      I would like to show graphics at a fixed 30 fps. The only solution I have is: while (true) { while (not ready) { check the performance timer() } draw() } The problem is that this method pegs the cpu. I would like to use one of these: - SetTimer and handle WM_TIMER - use WaitForSingleObject with a WaitableTimer possibly but they have too low a resolution. Can anyone see another solution? Thanks, Alex Griffing

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Use timeGettime and draw in your idle time if the right amount of time has passed. This solution will work if your system is too slow to do 30 fps and can be set so things still move at the same speed, albiet not as smoothly, and can clamp the top speed to 30 fps. Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002

      1 Reply Last reply
      0
      • A Alex Griffing

        I would like to show graphics at a fixed 30 fps. The only solution I have is: while (true) { while (not ready) { check the performance timer() } draw() } The problem is that this method pegs the cpu. I would like to use one of these: - SetTimer and handle WM_TIMER - use WaitForSingleObject with a WaitableTimer possibly but they have too low a resolution. Can anyone see another solution? Thanks, Alex Griffing

        J Offline
        J Offline
        Joaquin M Lopez Munoz
        wrote on last edited by
        #3

        Multimedia timers could be called for here. Check Nemanja Trifunovic's Timers tutorial. The minimum resolution attainable with these timers depends on the OS [and the hardware it is running on], but probably it is decent for your needs. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups