Results 1 to 10 of 12

Thread: Constant frame rate aka limit FPS

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Question Constant frame rate aka limit FPS

    I wonder how to limit FPS into simple 60 since now the game takes to much processor usage on Windows.

  2. #2
    This depends on the graphics library you are using.
    If you are using SDL, you might want to take a look at SDL_gfx which has some nice frame regulation functions or you may try to implement them yourself like described here: http://lazyfoo.net/SDL_tutorials/lesson14/index.php (It's C++-Code but it's relatively easy to port this to Object Pascal.)

    Edit: Sorry, I just noticed this was posted in the ZenGL forums. So my answer won't help you.
    Last edited by Stoney; 05-02-2011 at 07:00 PM.
    Freeze Development | Elysion Game Framework | Twitter: @Stoney_FD
    Check out my new book: Irrlicht 1.7.1 Realtime 3D Engine Beginner's Guide (It's C++ flavored though)

    Programmer: A device for converting coffein into software.

  3. #3
    Nah, not dependent on graphics library. I've found easiest way to insert TTimer on form with interval 17. It will be smooth, save your cpu and gpu and be very close to 60 fps.

  4. #4
    You might be interested in this post: http://www.pascalgamedevelopment.com...ll=1#post52894

    and perhaps a few above it

  5. #5
    Quote Originally Posted by dazappa View Post
    You might be interested in this post: http://www.pascalgamedevelopment.com...ll=1#post52894

    and perhaps a few above it
    Yeah I can say that VSync may work with not all video drivers. I don't see any effect when I turn on .

    With VSync: [00010966ms] Average FPS: 459
    Without VSync : [00014209ms] Average FPS: 458


    BTW, ZGL IDE is really neat idea.

  6. #6
    Quote Originally Posted by gintasdx
    Yeah I can say that VSync may work with not all video drivers. I don't see any effect when I turn on
    Only if this drivers configured to do not use VSync, or if drivers just a cr*p

    Quote Originally Posted by gintasdx
    There is good examples of limiting FPS using SDL_Delay()
    SDL_Delay is not good idea because it's just a Sleep function under Windows, and it far from "constant value". But yeah, you can limit your fps to ~61 with this function.

  7. #7
    Well actually you don't need to convert any C++ code. There is good examples of limiting FPS using SDL_Delay(); in JEDI-SDL package,SDLSpriteEngine demos folder.

Tags for this Thread

Bookmarks

Posting Permissions

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