Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » EXT_swap_control for OGL vsync?

This thread is locked; no one can reply to it. rss feed Print
EXT_swap_control for OGL vsync?
Arthur Kalliokoski
Second in Command
February 2005
avatar

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!

“Throughout history, poverty is the normal condition of man. Advances which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people. Whenever this tiny minority is kept from creating, or (as sometimes happens) is driven out of a society, the people then slip back into abject poverty. This is known as "bad luck.”

― Robert A. Heinlein

Marcello
Member #1,860
January 2002
avatar

You're welcome!

Epsi
Member #5,731
April 2005
avatar

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

___________________________________

piccolo: "soon all new 2d alegro games will be better. after i finsh my MMRPG. my game will serve as a code reference. so you can understand and grab code from."
piccolo: "just wait until my invetion comes out its going to take the wii to the next leave of game play. it will run sony and microsoft out of busness if i dont let them use it aswell."

GullRaDriel
Member #3,861
September 2003
avatar

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.

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

Arthur Kalliokoski
Second in Command
February 2005
avatar

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.

“Throughout history, poverty is the normal condition of man. Advances which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people. Whenever this tiny minority is kept from creating, or (as sometimes happens) is driven out of a society, the people then slip back into abject poverty. This is known as "bad luck.”

― Robert A. Heinlein

Go to: