Don''t quote me on this, but I don''t think that the API can do that. I think it is an OS setting.
I''m probably wrong though,
Landsknecht
I''m probably wrong though,
Landsknecht
This is OS dependent. Under Windows you do by using a Microsoft OpenGL extension. You turn it off like this:
#ifdef _WIN32
// Turn off vertical screen sync under Windows.
// (I.e. it uses the WGL_EXT_swap_control extension)
typedef BOOL (WINAPI *PFNWGLSWAPINTERVALEXTPROC)(int interval);
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = NULL;
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
ASSERT(wglSwapIntervalEXT);
wglSwapIntervalEXT(0);
#endif
Replace the the 0 argument to 1 to turn it on again.
To make this work you must #include <windows.h>
#ifdef _WIN32
// Turn off vertical screen sync under Windows.
// (I.e. it uses the WGL_EXT_swap_control extension)
typedef BOOL (WINAPI *PFNWGLSWAPINTERVALEXTPROC)(int interval);
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = NULL;
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
ASSERT(wglSwapIntervalEXT);
wglSwapIntervalEXT(0);
#endif
Replace the the 0 argument to 1 to turn it on again.
To make this work you must #include <windows.h>
Cool, that is news to me.
I have a related side question though... Why would you want to disable Vsynch?
Landsknecht
I have a related side question though... Why would you want to disable Vsynch?
Landsknecht
So his framerate isnt capped to the vertical refresh? So he can properly benchmark his applications performance?
-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack
-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack
You''ll get smoother gameplay at the cost of some visual tearing.
Basically if vsync is on, your game is forced to run at factors of the refresh rate, which can and will cause stutters if the frame rate wants to fluctuate.
e.g. your game runs at 50 fps. The monitor is set to 60, so the game ends up running at 30 fps most of the time, with the occasional 60.
By disabling vsync the game will run at the fastest rate it can.
Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
Basically if vsync is on, your game is forced to run at factors of the refresh rate, which can and will cause stutters if the frame rate wants to fluctuate.
e.g. your game runs at 50 fps. The monitor is set to 60, so the game ends up running at 30 fps most of the time, with the occasional 60.
By disabling vsync the game will run at the fastest rate it can.
Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
damn, I was too slow It took me too long to search for that link, heh
Turing vsync off is a good way to measure how fast your game is running You don''t get very good fps readouts with vsync enabled...
codeka.com - Just click it.
Turing vsync off is a good way to measure how fast your game is running You don''t get very good fps readouts with vsync enabled...
codeka.com - Just click it.
Hm. I just don''t see it. Testing with Vsynch off only gets results for that ONE machine. And only if you don''t have a capped frame rate. Oh well, whatever works for ya.
Landsknecht
Landsknecht
Yeah, you dont see it. If you can benchmark your game as doing 900 (example only, dont flame) fps on a certain hardware setup, and benchmark another at 300, theres a good comparison of how yours performs compared to the other, roughly 3 times faster.
Now if you had vsync on.. both would run at the same fps (unless you have a monitor with a rediculously high refresh rate). If both are locked at 80fps.. then how could you tell which runs faster?
-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack
Now if you had vsync on.. both would run at the same fps (unless you have a monitor with a rediculously high refresh rate). If both are locked at 80fps.. then how could you tell which runs faster?
-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement