Results 1 to 3 of 3

Thread: vertical sync and half performance

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2002

    vertical sync and half performance


    Does anyone know anything about this weird performance poblem?

    With vertical sync is on, sometimes fps drops to 30 from 60. And then hops back to normal.

    When i turn of vertical sync, there is NO performance decrease any kind of this, in the same circumstances. What may be causing the problem?

    btw, how can i turn vertical sync of programmatically?

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Reutlingen, Germany

    Re: vertical sync and half performance

    With V-Sync on there is the possibility, that your code runs exactly at a speed, which will cause a drop by 50%. However the possibility is VERY low, so you really have luck discovering this problem. Usually this does not happen.
    To enable or disable v-sync, there is the wgl_swap_control extension. Very easy to use.

    GLIM - Immediate Mode Emulation for GL3

  3. #3
    Super Moderator OpenGL Guru imported_dorbie's Avatar
    Join Date
    Jul 2000
    Bay Area, CA, USA

    Re: vertical sync and half performance

    This is very simple and should be expected. With vertical sync on you must complete your drawing in time for swapbuffers to be performed during the vertical retrace or you will be forced to wait on the next vertical retrace a full video frame later, even if you miss by a small amount. So draw times are always an integer multiple of the video field time.

    For example, at 60Hz video refresh, you must complete all your rendering in 16.7 milliseconds (1 second/60). If you do not hardware will miss it's opportunity to issue the swapbuffers during vertical refresh. Since swap is sync'd to vertical refresh the next opportunity will be a full 16.7 milliseconds later, for a grand total of 33.3 milliseconds since the last swap 1frame/33.3ms = 30Hz framerate. So if you cannot draw at 60Hz, you WILL draw at 30Hz, there are no intermediate frame rates possible.

    If you cannot complete draw in 33.3ms then you will drop to 20Hz, if you cannot complete in 50ms then you will drop to 15Hz, etc. etc.

    Simple, it's exactly what vsync is supposed to do.

    Things get a little more complex with a non blocking swap (I like to block, but I'm considered strange by the fps happy crowd), but don't be missled, it blocks for one frame only so unless you have an inconsistent draw time it won't greatly affect things, although it may fool you into thinking you got the occasional draw time that that wasn't a multiple of the video frame time, you didn't, you were just filling the graphics FIFO & maybe keeping the front end of the pipe busy while it was waiting on the swap, (unless you were tripple buffering, but I'm not even going there).

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

Similar Threads

  1. timing when vertical sync is ON
    By SergeVrt in forum OpenGL: Advanced Coding
    Replies: 7
    Last Post: 07-27-2005, 09:43 AM
  2. Vertical Sync
    By glfreak in forum OpenGL: Linux
    Replies: 14
    Last Post: 07-08-2004, 05:59 AM
  3. vertical sync
    By lesica in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 08-14-2002, 01:39 PM
  4. NVIDIA, GLX, Vertical Sync
    By in forum OpenGL: Linux
    Replies: 1
    Last Post: 07-18-2001, 12:53 PM
  5. Vertical sync -- which one?
    By hades in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 02-15-2001, 10:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean