Hi,

When experimenting with vsync under GNU/Linux, I noticed that
SDL_GL_SWAP_CONTROL was an "OpenGL attribute [] unsupported on this
system".

(I was using Pygame and first thought it was a pygame- or X11-specific
issue, but then I found out that I could use vsync with Pyglet so it
definitely should have worked).

The bug is due to (AFAICT) an implementation oversight in
video/x11/SDL_x11gl.c: it tries to load 'glXSwapIntervalMESA' or
'glXSwapIntervalSGI' dynamically from '/usr/lib/libGL.so.1', while it
should load them through 'glXGetProcAddressARB'.

The following tiny patch does just that, and I now get my smooth
scrolling :)

What do you think?

-- 
Sylvain
--- SDL_x11gl.c-orig	2010-05-23 20:37:14.000000000 +0200
+++ SDL_x11gl.c	2010-05-23 20:37:45.000000000 +0200
@@ -530,9 +530,9 @@
 	this->gl_data->glXQueryExtensionsString =
 		(const char *(*)(Display *, int)) GL_LoadFunction(handle, "glXQueryExtensionsString");
 	this->gl_data->glXSwapIntervalSGI =
-		(int (*)(int)) GL_LoadFunction(handle, "glXSwapIntervalSGI");
+		(int (*)(int)) this->gl_data->glXGetProcAddress("glXSwapIntervalSGI");
 	this->gl_data->glXSwapIntervalMESA =
-		(GLint (*)(unsigned)) GL_LoadFunction(handle, "glXSwapIntervalMESA");
+		(GLint (*)(unsigned)) this->gl_data->glXGetProcAddress("glXSwapIntervalMESA");
 
 	if ( (this->gl_data->glXChooseVisual == NULL) || 
 	     (this->gl_data->glXCreateContext == NULL) ||

Reply via email to