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

Thread: Synching Redraw with monitor refresh rate

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2011
    Posts
    3

    Synching Redraw with monitor refresh rate

    Hi
    Ok so i have a lcd monitor with a refresh rate of 60hz. What i want to do is synchronize my drawing with the refresh rate. So i might draw a circle on the first refresh and then wait 59 refreshes after which I draw a square. Basically i need to treat it like a slide show sought of.
    How would i do this.
    Cheers
    Damian

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Mar 2009
    Location
    Karachi, Pakistan
    Posts
    810

    Re: Synching Redraw with monitor refresh rate

    which platform are u in windows/linux? and which utility toolkit if any are u using. FYI glut automatically keeps vsync on by default.
    Regards,
    Mobeen

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2011
    Posts
    3

    Re: Synching Redraw with monitor refresh rate

    windows, no im not using a toolkit thought if thats required thats no prob. Basically what i want is like being able to assing a calback to the actual draw event, such that if the monitor were 60hz it would get called 60 times per second. Is there any way to do this.
    Cheers
    Damian

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

    Re: Synching Redraw with monitor refresh rate

    There is no callback on vsync AFAIK.

    If you really want to be tied to 1/60 of the refresh rate, you can do wglSwapInterval(60);

    Or simply run a timer within your code, triggered every second, with vsync on using wglSwapInterval(1); to avoid any tearing. This is a better solution, if you do not mind a little jitter (depending on timer precision, between rendered frame you may have 58 or 61 refreshes).

  5. #5
    Junior Member Newbie
    Join Date
    Feb 2011
    Posts
    3

    Re: Synching Redraw with monitor refresh rate

    I am using windows and glut. What is the header for wglswapinterval. It cant find the function
    Cheers
    Damian

  6. #6
    Advanced Member Frequent Contributor
    Join Date
    Mar 2009
    Location
    Karachi, Pakistan
    Posts
    810

    Re: Synching Redraw with monitor refresh rate

    U would need glew for this and.
    #include wglew.h
    Regards,
    Mobeen

  7. #7
    Senior Member OpenGL Lord
    Join Date
    May 2009
    Posts
    6,031

    Re: Synching Redraw with monitor refresh rate

    You don't specifically need GLEW. Any extension loading software would do. Or just load the swap interval extension yourself.

Posting Permissions

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