Skip to main content
GameDev.net gamedev.net
🔒 Locked

Taming VSYNC!

Started by sipickles Feb 21, 2005 at 12:13 PM 7 replies 650+ views
Original Post
sipickles
sipickles
Further to my post about my flickery images, can anyone tell me how to control vsync from within my app? Many thanks
Palidine
Palidine
what do you mean "control vsync"? you can either have it off or on. it's not a sliding scale. When vsync is on, your graphics card waits to swap the screen buffer until the monitor is ready for it. This means that your FPS will be _capped_ at the refresh rate of the monitor. With vsync on it is possible to have an FPS anywhere in the range of 0-monitor refresh rate. With vsync off, there is no FPS cap so the range is 0-infinity (depending on how uber your hardware is and how tight your code is).

That said it is possible to turn vsync off or on in code. It requires some simple API calls which will vary based on which graphics API you are using. a quick google of something like: "vsync opengl" should yeald some quick answers. I'd imagine that there is also an article or two that discusses this in the Articles section of this site.

-me
sipickles
sipickles
I mean, have the application turn it ON or OFF, thats all.

Changing it in my display properties doesnt work! wondered what the method to swithc using application was.....

thanks
Palidine
Palidine
[google]: "vsync opengl"

or replace opengl with your graphics API

[EDIT: but also, are you sure that the control panel thing doesn't work? how do you know it didn't work? are you running at _exactly_ the refresh rate of the monitor? i.e. change the refresh rate of your monitor: if the FPS of your application doesn't change then vsync isn't your problem. vsync would also not cause flickery images]

-me
Evil Steve
Evil Steve
To disable vsync, you set the PresentationInterval member of your D3DPRESENT_PARAMETERS structure to D3DPRESENT_INTERVAL_IMMEDIATE. To turn on vsync, set it to D3DPRESENT_INTERVAL_ONE. If you want to change vsync while your app is running, you need to call IDirect3DDevice::Reset(), or re-create your device.
sipickles
sipickles
Thanks Steve, thats the info i was after :)
sipickles
sipickles
Hmm, Maybe I should have mentioned I am still using DX8.1!
JoeyBlow2
JoeyBlow2
It should be nearly the same for DX 8.1. I think the names were "SwapEffect" in DX8.1.

D3DSWAPEFFECT_COPYVSYNC

Look for Swap effect in the help to see the choices.
DrunkenHyena
DrunkenHyena
Taking a quick peek at the docs shows that the member is called:
FullScreen_PresentationInterval

Setting it to D3DPRESENT_INTERVAL_IMMEDIATE turns off vsync, to enable it use D3DPRESENT_INTERVAL_ONE. More info is available in the documentation.
Stay Casual,KenDrunken Hyena</FON

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.