PDA

View Full Version : Disabling VSync on Linux



Brainer
23-11-2007, 06:09 AM
Hello. :)

I use this snippet to disable VSync on Windows:

uses
dglOpenGL;
(...)
if WGL_EXT_swap_control then
wglSwapIntervalEXT(0);


But how to disable VSync on Linux? :?

dmantione
23-11-2007, 05:35 PM
The DRI scans ~/.drirc and will use the VSYNC behaviour specified in that file. You cannot override this, I checked the source code for that. Yes, it sucks.

grudzio
23-11-2007, 05:45 PM
How about GLX_SGI_swap_control (http://www.opengl.org/registry/specs/SGI/swap_control.txt) extension?

Brainer
23-11-2007, 06:15 PM
How about GLX_SGI_swap_control (http://www.opengl.org/registry/specs/SGI/swap_control.txt) extension?

Oh, I've never heard of such an extension! :o I suppose there is a function called glxSwapIntervalEXT(), am I right? :?

grudzio
23-11-2007, 07:32 PM
Oh, I've never heard of such an extension! :o I suppose there is a function called glxSwapIntervalEXT(), am I right? :?

glXSwapIntervalSGI to be exact. I haven't found its declaration in glx shipped with fpc compiler (2.0.4) so You may have to modify the glx.pas file (or any other OpenGL header You are using).

Brainer
23-11-2007, 07:47 PM
I use dglOpenGL.pas and I doubt such a declaration is in that file. :( Am I wrong?

grudzio
23-11-2007, 09:01 PM
I use dglOpenGL.pas and I doubt such a declaration is in that file. Am I wrong?
I don't know. I am using JEDI_SDL OpenGL headers. Last time I looked at dglOpenGL.pas (about two years ago) it didn't have any glx stuff in it.

My suggestion is to get the JEDI_SDL glx.pas and modify it to include glXSwapIntervalSGI.
In the interface section add the following line to the MESA extensions

glXSwapIntervalSGI: function(interval: Integer): Integer; cdecl;

Then modify InitGLXFromLibrary function by adding the following line

glXSwapIntervalSGI := GetModuleSymbol(libglx, 'glXSwapIntervalSGI');

Then include glx.pas in Your project, compile and hope for the best.

If you don't use JEDI_SDL you may want to make these changes to the glx.pas that comes with FPC, since JEDI_SDL uses its own functions for loading dynamic libraries (defined in moduleloader.pas).

Brainer
24-11-2007, 04:22 AM
Well, from now on I'll be using glx.pas. :) By the way - grudzio, can you send me OpenGL libraries suitable for Linux, please? ;)

grudzio
24-11-2007, 06:51 PM
Any compiler that runs under Linux with support for OpenGL will have appopriate headers. The glx file contains only functions that are specific for X Windows System. They are X window equivalents of MS Windows wgl and MacOS agl functions. The core of OpenGL library contained in gl and glu files is same for all platforms.

Brainer
24-11-2007, 07:59 PM
Okay, thanks for your precious information and time! ;)
A przy okazji, to pozdrawiam rodaka! :) Sorry for non-English sentence

grudzio
25-11-2007, 08:55 PM
Okay, thanks for your precious information and time! No problem.