EXT_swap_control for OGL vsync?
Arthur Kalliokoski

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!

Marcello

You're welcome!

Epsi

Can you post the answer ? I would like to enable it under OpenLayer.

GullRaDriel

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.

Arthur Kalliokoski

The google group page in my history is

http://groups.google.com/group/comp.graphics.api.opengl/browse_thread/thread/5a1ee68ded22a2c1/4ad93f2a1ff607cd?lnk=gst&q=vsync+wgl+swap&rnum=1#4ad93f2a1ff607cd

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)

1void STDCALL (*vsync)(int speed); //STDCALL means the caller doesn't have to clean up
2 //stack, it's a Winduhs thing
3 
4int 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.

Thread #586770. Printed from Allegro.cc