Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: "EXT_swap_control extension" unexpected behaviour

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2007
    Location
    Eindhoven
    Posts
    8

    "EXT_swap_control extension" unexpected behaviour

    Hi,

    I've just "implemented" the EXT_swap_control extension. I set the "video frame period" with the wglSwapIntervalEXT(int interval) function.

    My lcd-screen refresh rate is 60 Hz, or so says the property window.

    If I pass an interval value of 0, I (indeed) get a fps of 500+ (no vsync). But passing 1 gives 120 (?). Passing 2 gives 60, passing 3 gives 40, passing 4 gives 20...

    Why would passing an interval value of 1 give a fps result that doubles the monitor refresh rate?

    I'm working on a MacBook Pro with XP32 under bootcamp. It has an nVidia 8600M GT videocard. But other computers give simular results. I have a standard double-buffered render loop:
    Render(...);
    glFlush();
    SwapBuffers(...);

    Kind Regards,
    Daniel Dekkers

  2. #2
    Junior Member Regular Contributor
    Join Date
    Mar 2007
    Location
    Latvia
    Posts
    225

    Re: "EXT_swap_control extension" unexpected behaviour

    Try taking out glFlush function.
    Also how do you measure fps?

  3. #3
    Junior Member Newbie
    Join Date
    Oct 2007
    Location
    Eindhoven
    Posts
    8

    Re: "EXT_swap_control extension" unexpected behaviour

    Removing glFlush doesn't change the fps results.
    I'm using this function with a high-resolution counter c_StopWatch...

    std::wstring
    c_WindowOpenGL::GetFrameRate(void)
    {
    static bool l_StopWatchCounting = false;
    static int l_Fps = -1;
    std::wstring l_String;
    static c_StopWatch l_StopWatch;
    static int l_NrOfFrames;

    if (!l_StopWatchCounting)
    {
    // Initialise the StopWatch...
    l_StopWatch.SetTime(0.0);
    l_StopWatch.ResumeTime();
    l_StopWatchCounting = true;
    return TEXT("FPS: NA");
    }
    else
    {
    if (l_StopWatch.ElapsedTime()>1.0)
    {
    // We have a valid frame rate for this second...
    l_Fps = l_NrOfFrames;
    // Reset the stopwatch...
    l_NrOfFrames = 0;
    l_StopWatch.SetTime(0.0);
    l_StopWatch.ResumeTime();
    }
    else
    {
    // Add 1 to the frame rate counter...
    ++l_NrOfFrames;
    }

    if (l_Fps==-1)
    {
    return TEXT("FPS: NA");
    }
    else
    {
    return str(boost::wformat(TEXT("FPS: %d")) % l_Fps);
    }
    }
    }

  4. #4
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,370

    Re: "EXT_swap_control extension" unexpected behaviour

    Did you read the spec?
    http://www.opengl.org/registry/specs...ap_control.txt

    Actually I do understand myself this sentence:

    An interval set to a value of 2
    means that the color buffers will be swapped at most every other video
    frame.

  5. #5
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: "EXT_swap_control extension" unexpected behaviour

    It sounds like you count your frames twice.
    For 60hz lcd, I always have :
    0: inf+
    1: 60
    2: 30
    3: 20
    ... never tried farther.

Posting Permissions

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