I've been looking at the code for glut, AllegroGL, Irrilicht etc. trying to figure out how they disable vsync in an OGL program. As far as I can see, they're using the WGL_EXT_swap_control extension. It's listed in the string list, but when I call it with wglGetProcess() it returns zero. I've double and triple checked the spelling to it, and tried another extension just to make sure I was doing it right, but no go.
Anybody know of alternative methods?
Cookies in a couple days, patience please!
[EDIT]
Nvm, I found something in google groups, thanx!
You're welcome!
Can you post the answer ? I would like to enable it under OpenLayer.
AFAIK about vsync, You can try to enable/disable it, but the driver value is on top of whatever you choose.
Example: if in the Nvidia/Ati Display control panel there is Vsync -> always off, no way for your code to bypass.
The google group page in my history is
Technically you're supposed to have some casts from glext.h or something, I didn't try it in mingw, watcom didn't complain. Vidcard PNY Geforce 5500 (nvidia offshoot)
1 | void STDCALL (*vsync)(int speed); //STDCALL means the caller doesn't have to clean up |
2 | //stack, it's a Winduhs thing |
3 | |
4 | int WinMain(blah blah) |
5 | { |
6 | //setup screen mode, lighting load models etc. |
7 | |
8 | //here you're supposed to search for a string in the table, but since this next |
9 | //returns 0 on failure, why bother? |
10 | |
11 | vsync = wglGetProcAddress("wglSwapIntervalEXT"); |
12 | if(vsync) vsync(0); |
13 | |
14 | //game loop went from 60.0fps to 500 umpty ump |
15 | } |
I suppose to turn it on, you'd pass some non zero number instead of vsync(0)
[EDIT]
Oh, yeah, in the systray thing there is no mention of turning vsync on/off, just antialiasing, filtering etc.
[EDIT 2]
I tried it in Linux, and found a function called glXSetIntervalEXT() where Linux didn't automatically set vsync, passing 1 got it down to 92 fps, and passing 2 brought it down to 50 fps. The winduhs thing went back to 60 fps with any non zero value passed to vsync.