2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2009 Sam Lantinga
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #include "SDL_config.h"
24 #if SDL_VIDEO_OPENGL_GLX
26 #include "SDL_loadso.h"
29 #include "../SDL_sysvideo.h"
31 struct SDL_PrivateGLData {
32 int gl_active; /* to stop switching drivers while we have a valid context */
34 #if SDL_VIDEO_OPENGL_GLX
35 GLXContext glx_context; /* Current GL context */
36 XVisualInfo* glx_visualinfo; /* XVisualInfo* returned by glXChooseVisual */
38 void * (*glXGetProcAddress)(const GLubyte *procName);
40 XVisualInfo* (*glXChooseVisual)
45 GLXContext (*glXCreateContext)
51 void (*glXDestroyContext)
55 Bool (*glXMakeCurrent)
60 void (*glXSwapBuffers)
62 GLXDrawable drawable );
66 XVisualInfo* visual_info,
70 const char *(*glXQueryExtensionsString)
74 int (*glXSwapIntervalSGI) ( int interval );
75 GLint (*glXSwapIntervalMESA) ( unsigned interval );
77 #endif /* SDL_VIDEO_OPENGL_GLX */
80 /* Old variable names */
81 #define gl_active (this->gl_data->gl_active)
82 #define glx_context (this->gl_data->glx_context)
83 #define glx_visualinfo (this->gl_data->glx_visualinfo)
85 /* OpenGL functions */
86 extern XVisualInfo *X11_GL_GetVisual(_THIS);
87 extern int X11_GL_CreateWindow(_THIS, int w, int h);
88 extern int X11_GL_CreateContext(_THIS);
89 extern void X11_GL_Shutdown(_THIS);
90 #if SDL_VIDEO_OPENGL_GLX
91 extern int X11_GL_MakeCurrent(_THIS);
92 extern int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value);
93 extern void X11_GL_SwapBuffers(_THIS);
94 extern int X11_GL_LoadLibrary(_THIS, const char* path);
95 extern void *X11_GL_GetProcAddress(_THIS, const char* proc);
97 extern void X11_GL_UnloadLibrary(_THIS);