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 4 of 4

Thread: WGL_EXT_swap_control and SwapBuffers

  1. #1
    Member Regular Contributor
    Join Date
    Jun 2002
    Posts
    371

    WGL_EXT_swap_control and SwapBuffers

    Hey

    In the WGL_EXT_swap_control specs it says that when you specify a swap interval of 0 buffer swaps are not synchronized to the video frame.

    My question is, if my swap interval is 0(vsync disabled), does this mean that after I call SwapBuffers I can be sure that the buffers have been swapped? In other words, does SwapBuffers block until completion?

    [EDIT] BTW, I am using double buffered pbuffers.

    Thanks in advance
    /Mathias


    [This message has been edited by roffe (edited 04-04-2003).]

  2. #2
    Super Moderator OpenGL Guru dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    4,388

    Re: WGL_EXT_swap_control and SwapBuffers

    Vsync of swap is not the same as block on swap.

    The implementations on Windows block on the second swap being issued. i.e swap only blocks IF there is another swap that hasn't yet completed. Even with vsync set to 1 you will not be blocking, just waiting until retrace before the swap happens.

    This is generally considered as 'correct' behaviour. Vendors always implement this because they can get more transmit & T&L done while waiting on the swap to happen.

    To block, issue a glFinish after the swap. It is recommended that you try and utilize the CPU instead of waiting idle for vertical retrace. For latency purposes I advise polling input after a glFinish and doing the POV dynamic motion & other major dynamics, but only if this doesn't take too long. This is an issue of contention with some vendors advising against this, they want you to exploit graphics capability instead of stalling the pipeline while you wait.

  3. #3
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421

    Re: WGL_EXT_swap_control and SwapBuffers

    but it's not possible to query to know if a swap is in progress, right?
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

  4. #4
    Member Regular Contributor
    Join Date
    Jun 2002
    Posts
    371

    Re: WGL_EXT_swap_control and SwapBuffers

    Originally posted by dorbie:

    To block, issue a glFinish after the swap.
    Ok, thanks. I always considered SwapBuffers "separate" from the gl context, in the sense that I couldn't control it. If I can use glFinish, I am assuming I can also insert a fence(NV_FENCE) and poll for its completion. Correct?

Posting Permissions

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