Question

I'm trying to disable vertical sync on Linux in a program built around SDL and openGL. I am running an old integrated ATI card with Gallium 0.4 as the driver.

I attempt to disable vsync by calling glXSwapInterval(0) in my code, but when I do this, although the program compiles fine, I get a segfault when I try to run it.

gdb gives me the rather unhelpful message:

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()

Does anyone have any idea as to what might be going on?

Was it helpful?

Solution

glXSwapIntervalEXT and glXSwapIntervalSGI are extension functions; You normally access extensions' function addresses through glXGetProcAddress, though some libGL.so may export them directly.

Most easy solution: Get a OpenGL extension loader library, like GLEW (it's in all major Linux distribution's package repositories). Replace all occurances of #include <GL/gl.h> with #include <GL/glew.h> and #include <GL/glx.h> with #include <GL/glxew.h>, add libGLEW.so to your list of linked libraries, and call glewInit() right after creating and binding a OpenGL context. Then test if the extension is actually available!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top