Mercurial > sdl-ios-xcode
changeset 4546:6f0706a60146 SDL-1.2
Fixed bug 1006
Get the GLX functions with glXGetProcAddress() when available.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 18 Jul 2010 11:11:37 -0700 |
parents | 134c6707b767 |
children | 963f939494a1 |
files | src/video/x11/SDL_x11gl.c |
diffstat | 1 files changed, 15 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/video/x11/SDL_x11gl.c Sun Jul 18 10:51:25 2010 -0700 +++ b/src/video/x11/SDL_x11gl.c Sun Jul 18 11:11:37 2010 -0700 @@ -512,27 +512,30 @@ /* Unload the old driver and reset the pointers */ X11_GL_UnloadLibrary(this); + /* Save the handle for X11_GL_GetProcAddress() */ + this->gl_config.dll_handle = handle; + /* Load new function pointers */ this->gl_data->glXGetProcAddress = (void *(*)(const GLubyte *)) GL_LoadFunction(handle, "glXGetProcAddressARB"); this->gl_data->glXChooseVisual = - (XVisualInfo *(*)(Display *, int, int *)) GL_LoadFunction(handle, "glXChooseVisual"); + (XVisualInfo *(*)(Display *, int, int *)) X11_GL_GetProcAddress(this, "glXChooseVisual"); this->gl_data->glXCreateContext = - (GLXContext (*)(Display *, XVisualInfo *, GLXContext, int)) GL_LoadFunction(handle, "glXCreateContext"); + (GLXContext (*)(Display *, XVisualInfo *, GLXContext, int)) X11_GL_GetProcAddress(this, "glXCreateContext"); this->gl_data->glXDestroyContext = - (void (*)(Display *, GLXContext)) GL_LoadFunction(handle, "glXDestroyContext"); + (void (*)(Display *, GLXContext)) X11_GL_GetProcAddress(this, "glXDestroyContext"); this->gl_data->glXMakeCurrent = - (int (*)(Display *, GLXDrawable, GLXContext)) GL_LoadFunction(handle, "glXMakeCurrent"); + (int (*)(Display *, GLXDrawable, GLXContext)) X11_GL_GetProcAddress(this, "glXMakeCurrent"); this->gl_data->glXSwapBuffers = - (void (*)(Display *, GLXDrawable)) GL_LoadFunction(handle, "glXSwapBuffers"); + (void (*)(Display *, GLXDrawable)) X11_GL_GetProcAddress(this, "glXSwapBuffers"); this->gl_data->glXGetConfig = - (int (*)(Display *, XVisualInfo *, int, int *)) GL_LoadFunction(handle, "glXGetConfig"); + (int (*)(Display *, XVisualInfo *, int, int *)) X11_GL_GetProcAddress(this, "glXGetConfig"); this->gl_data->glXQueryExtensionsString = - (const char *(*)(Display *, int)) GL_LoadFunction(handle, "glXQueryExtensionsString"); + (const char *(*)(Display *, int)) X11_GL_GetProcAddress(this, "glXQueryExtensionsString"); this->gl_data->glXSwapIntervalSGI = - (int (*)(int)) GL_LoadFunction(handle, "glXSwapIntervalSGI"); + (int (*)(int)) X11_GL_GetProcAddress(this, "glXSwapIntervalSGI"); this->gl_data->glXSwapIntervalMESA = - (GLint (*)(unsigned)) GL_LoadFunction(handle, "glXSwapIntervalMESA"); + (GLint (*)(unsigned)) X11_GL_GetProcAddress(this, "glXSwapIntervalMESA"); if ( (this->gl_data->glXChooseVisual == NULL) || (this->gl_data->glXCreateContext == NULL) || @@ -541,11 +544,12 @@ (this->gl_data->glXSwapBuffers == NULL) || (this->gl_data->glXGetConfig == NULL) || (this->gl_data->glXQueryExtensionsString == NULL)) { + GL_UnloadObject(this->gl_config.dll_handle); + this->gl_config.dll_handle = NULL; SDL_SetError("Could not retrieve OpenGL functions"); return -1; } - this->gl_config.dll_handle = handle; this->gl_config.driver_loaded = 1; if ( path ) { SDL_strlcpy(this->gl_config.driver_path, path, @@ -558,13 +562,10 @@ void *X11_GL_GetProcAddress(_THIS, const char* proc) { - void* handle; - - handle = this->gl_config.dll_handle; if ( this->gl_data->glXGetProcAddress ) { return this->gl_data->glXGetProcAddress((const GLubyte *)proc); } - return GL_LoadFunction(handle, proc); + return GL_LoadFunction(this->gl_config.dll_handle, proc); } #endif /* SDL_VIDEO_OPENGL_GLX */