Frage

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?

War es hilfreich?

Lösung

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!

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top