Results 1 to 7 of 7

Thread: about FPS

  1. #1
    Lesser Knight
    Join Date
    Oct 2007
    Posts
    57

    Default about FPS

    I use clanlib 0.80 before and now maybe is 0.81 . I found that my game's FPS was limited 60.First I doubt because I change my OS,from XP to another windows XP.But other game's FPS no limited.
    It's the different between 0.80 and 0.81? 0.81 have a function to limited FPS to max 60?
    Somebody can tell me?Thanks advance.

  2. #2
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Nothing has changed, as far as I know.

    Maybe you have changed an option in the graphics driver settings
    For example NVIDIA Control Panel - Vertical sync - forced on

  3. #3
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Note:

    CL_Display::flip() - Locks to the default frame rate
    CL_Display::flip(-1) - Locks to the default frame rate
    CL_Display::flip(0) - Do not lock to the frame rate
    CL_Display::flip(1) - Sync to every frame
    CL_Display::flip(2) - Sync to every 2nd frame

  4. #4
    Lesser Knight
    Join Date
    Oct 2007
    Posts
    57

    Default you are right

    Hey,rombust,Thank you very much,I chang the CL_Display::flip() parameter and comment the "CL_System::sleep(1);" than the FPS up to 1000+;
    By the way.Is there a way that control FPS to a exact number?
    My mean,every computer is all a number ,not the system default number?

  5. #5
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    CL_FramerateCounter

    In ClanLib 2.0, this class has been removed.

    If you require it. Copy the source from ClanLib 1.0. and modify these lines:

    From: class CL_API_DISPLAY CL_FramerateCounter : public CL_KeepAlive
    To: class CL_FramerateCounter

    And call "framerate_counter.keep_alive();" in the main loop

  6. #6
    Lesser Knight
    Join Date
    Oct 2007
    Posts
    57

    Default

    Oh,rombust,thank you so much. I use 1.0 but I never find have a class "CL_FramerateCounter".
    If I use 1.0,my code:

    framerate_counter.set_fps_limit(60);
    CL_Display::flip(0);
    CL_System::keep_alive();

    I found the FPS is not 60,is 100 up or down.
    Last edited by DavinciZhe; 10-22-2009 at 08:48 AM.

  7. #7
    Lesser Knight
    Join Date
    Oct 2007
    Posts
    57

    Default very strange!

    I use under code to count FPS:

    int calc_fps(int frame_time)
    {
    static int fps_result = 0;
    static int fps_counter = 0;
    static int total_time = 0;

    total_time += frame_time;
    if(total_time >= 1000) // One second has passed
    {
    fps_result = fps_counter + 1;
    fps_counter = total_time = 0;
    }
    fps_counter++; // Increase fps

    return fps_result;
    }

    void time_delay()
    {
    static int start_time = CL_System::get_time();

    int cur_time = CL_System::get_time();
    gl_timePerFrame = cur_time - start_time;
    start_time = cur_time;

    gl_fps = calc_fps(gl_timePerFrame);////debugme---发行时删掉
    }

    these code is from 0.80 Clanlib help.

    if use these two function and framerate_counter.set_fps_limit(60);,the FPS
    is not 60.
    But,but:these two function count :

    CL_Display::flip();
    CL_System::keep_alive();

    the FPS is 60,and framerate_counter.get_fps() is also 60???
    very stranger??

Bookmarks

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
  •