src/video/x11/SDL_x11gl.c
author Sam Lantinga <slouken@libsdl.org>
Thu, 16 Feb 2006 10:11:48 +0000
changeset 1361 19418e4422cb
parent 1358 c71e05b4dc2e
child 1379 c0a74f199ecf
permissions -rw-r--r--
New configure-based build system. Still work in progress, but much improved
slouken@0
     1
/*
slouken@0
     2
    SDL - Simple DirectMedia Layer
slouken@1312
     3
    Copyright (C) 1997-2006 Sam Lantinga
slouken@0
     4
slouken@0
     5
    This library is free software; you can redistribute it and/or
slouken@1312
     6
    modify it under the terms of the GNU Lesser General Public
slouken@0
     7
    License as published by the Free Software Foundation; either
slouken@1312
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@0
     9
slouken@0
    10
    This library is distributed in the hope that it will be useful,
slouken@0
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@0
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1312
    13
    Lesser General Public License for more details.
slouken@0
    14
slouken@1312
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1312
    16
    License along with this library; if not, write to the Free Software
slouken@1312
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@0
    18
slouken@0
    19
    Sam Lantinga
slouken@252
    20
    slouken@libsdl.org
slouken@0
    21
*/
slouken@0
    22
slouken@0
    23
#include "SDL_x11video.h"
slouken@1361
    24
#include "../../events/SDL_events_c.h"
slouken@0
    25
#include "SDL_x11dga_c.h"
slouken@0
    26
#include "SDL_x11gl_c.h"
slouken@0
    27
slouken@862
    28
#if defined(sgi)
slouken@862
    29
/* IRIX doesn't have a GL library versioning system */
slouken@862
    30
#define DEFAULT_OPENGL	"libGL.so"
icculus@1191
    31
#elif defined(MACOSX)
icculus@1191
    32
#define DEFAULT_OPENGL	"/usr/X11R6/lib/libGL.1.dylib"
slouken@862
    33
#else
slouken@0
    34
#define DEFAULT_OPENGL	"libGL.so.1"
slouken@862
    35
#endif
slouken@0
    36
slouken@667
    37
#ifndef GLX_ARB_multisample
slouken@667
    38
#define GLX_ARB_multisample
slouken@667
    39
#define GLX_SAMPLE_BUFFERS_ARB             100000
slouken@667
    40
#define GLX_SAMPLES_ARB                    100001
slouken@667
    41
#endif
slouken@667
    42
slouken@0
    43
XVisualInfo *X11_GL_GetVisual(_THIS)
slouken@0
    44
{
slouken@1361
    45
#if SDL_VIDEO_OPENGL_GLX
slouken@0
    46
	/* 64 seems nice. */
slouken@0
    47
	int attribs[64];
slouken@0
    48
	int i;
slouken@0
    49
slouken@0
    50
	/* load the gl driver from a default path */
slouken@0
    51
	if ( ! this->gl_config.driver_loaded ) {
slouken@0
    52
	        /* no driver has been loaded, use default (ourselves) */
slouken@0
    53
	        if ( X11_GL_LoadLibrary(this, NULL) < 0 ) {
slouken@0
    54
		        return NULL;
slouken@0
    55
		}
slouken@0
    56
	}
slouken@0
    57
slouken@0
    58
	/* See if we already have a window which we must use */
slouken@0
    59
	if ( SDL_windowid ) {
slouken@0
    60
		XWindowAttributes a;
slouken@0
    61
		XVisualInfo vi_in;
slouken@0
    62
		int out_count;
slouken@0
    63
icculus@1168
    64
		pXGetWindowAttributes(SDL_Display, SDL_Window, &a);
slouken@0
    65
		vi_in.screen = SDL_Screen;
icculus@1168
    66
		vi_in.visualid = pXVisualIDFromVisual(a.visual);
icculus@1168
    67
		glx_visualinfo = pXGetVisualInfo(SDL_Display,
slouken@0
    68
	                     VisualScreenMask|VisualIDMask, &vi_in, &out_count);
slouken@0
    69
		return glx_visualinfo;
slouken@0
    70
	}
slouken@0
    71
slouken@0
    72
        /* Setup our GLX attributes according to the gl_config. */
slouken@450
    73
	i = 0;
slouken@450
    74
	attribs[i++] = GLX_RGBA;
slouken@0
    75
	attribs[i++] = GLX_RED_SIZE;
slouken@0
    76
	attribs[i++] = this->gl_config.red_size;
slouken@0
    77
	attribs[i++] = GLX_GREEN_SIZE;
slouken@0
    78
	attribs[i++] = this->gl_config.green_size;
slouken@0
    79
	attribs[i++] = GLX_BLUE_SIZE;
slouken@0
    80
	attribs[i++] = this->gl_config.blue_size;
slouken@0
    81
slouken@0
    82
	if( this->gl_config.alpha_size ) {
slouken@0
    83
		attribs[i++] = GLX_ALPHA_SIZE;
slouken@0
    84
		attribs[i++] = this->gl_config.alpha_size;
slouken@0
    85
	}
slouken@0
    86
slouken@0
    87
	if( this->gl_config.buffer_size ) {
slouken@450
    88
		attribs[i++] = GLX_BUFFER_SIZE;
slouken@450
    89
		attribs[i++] = this->gl_config.buffer_size;
slouken@0
    90
	}
slouken@0
    91
slouken@0
    92
	if( this->gl_config.double_buffer ) {
slouken@0
    93
		attribs[i++] = GLX_DOUBLEBUFFER;
slouken@0
    94
	}
slouken@0
    95
slouken@0
    96
	attribs[i++] = GLX_DEPTH_SIZE;
slouken@0
    97
	attribs[i++] = this->gl_config.depth_size;
slouken@0
    98
slouken@0
    99
	if( this->gl_config.stencil_size ) {
slouken@0
   100
		attribs[i++] = GLX_STENCIL_SIZE;
slouken@0
   101
		attribs[i++] = this->gl_config.stencil_size;
slouken@0
   102
	}
slouken@0
   103
slouken@0
   104
	if( this->gl_config.accum_red_size ) {
slouken@450
   105
		attribs[i++] = GLX_ACCUM_RED_SIZE;
slouken@0
   106
		attribs[i++] = this->gl_config.accum_red_size;
slouken@0
   107
	}
slouken@0
   108
slouken@0
   109
	if( this->gl_config.accum_green_size ) {
slouken@450
   110
		attribs[i++] = GLX_ACCUM_GREEN_SIZE;
slouken@0
   111
		attribs[i++] = this->gl_config.accum_green_size;
slouken@0
   112
	}
slouken@0
   113
slouken@0
   114
	if( this->gl_config.accum_blue_size ) {
slouken@450
   115
		attribs[i++] = GLX_ACCUM_BLUE_SIZE;
slouken@0
   116
		attribs[i++] = this->gl_config.accum_blue_size;
slouken@0
   117
	}
slouken@0
   118
slouken@0
   119
	if( this->gl_config.accum_alpha_size ) {
slouken@450
   120
		attribs[i++] = GLX_ACCUM_ALPHA_SIZE;
slouken@0
   121
		attribs[i++] = this->gl_config.accum_alpha_size;
slouken@0
   122
	}
slouken@0
   123
slouken@450
   124
	if( this->gl_config.stereo ) {
slouken@450
   125
		attribs[i++] = GLX_STEREO;
slouken@450
   126
		attribs[i++] = this->gl_config.stereo;
slouken@450
   127
	}
slouken@655
   128
	
slouken@656
   129
	if( this->gl_config.multisamplebuffers ) {
slouken@655
   130
		attribs[i++] = GLX_SAMPLE_BUFFERS_ARB;
slouken@656
   131
		attribs[i++] = this->gl_config.multisamplebuffers;
slouken@655
   132
	}
slouken@655
   133
	
slouken@656
   134
	if( this->gl_config.multisamplesamples ) {
slouken@655
   135
		attribs[i++] = GLX_SAMPLES_ARB;
slouken@656
   136
		attribs[i++] = this->gl_config.multisamplesamples;
slouken@655
   137
	}
slouken@450
   138
slouken@0
   139
#ifdef GLX_DIRECT_COLOR /* Try for a DirectColor visual for gamma support */
slouken@1336
   140
	if ( !SDL_getenv("SDL_VIDEO_X11_NODIRECTCOLOR") ) {
slouken@1060
   141
		attribs[i++] = GLX_X_VISUAL_TYPE;
slouken@1060
   142
		attribs[i++] = GLX_DIRECT_COLOR;
slouken@1060
   143
	}
slouken@0
   144
#endif
slouken@0
   145
	attribs[i++] = None;
slouken@0
   146
slouken@0
   147
 	glx_visualinfo = this->gl_data->glXChooseVisual(GFX_Display, 
slouken@0
   148
						  SDL_Screen, attribs);
slouken@0
   149
#ifdef GLX_DIRECT_COLOR
slouken@1336
   150
	if( !glx_visualinfo && !SDL_getenv("SDL_VIDEO_X11_NODIRECTCOLOR") ) { /* No DirectColor visual?  Try again.. */
slouken@0
   151
		attribs[i-3] = None;
slouken@0
   152
 		glx_visualinfo = this->gl_data->glXChooseVisual(GFX_Display, 
slouken@0
   153
						  SDL_Screen, attribs);
slouken@0
   154
	}
slouken@0
   155
#endif
slouken@0
   156
	if( !glx_visualinfo ) {
slouken@0
   157
		SDL_SetError( "Couldn't find matching GLX visual");
slouken@0
   158
		return NULL;
slouken@0
   159
	}
slouken@1315
   160
/*
slouken@1315
   161
	printf("Found GLX visual 0x%x\n", glx_visualinfo->visualid);
slouken@1315
   162
*/
slouken@0
   163
	return glx_visualinfo;
slouken@0
   164
#else
slouken@0
   165
	SDL_SetError("X11 driver not configured with OpenGL");
slouken@0
   166
	return NULL;
slouken@0
   167
#endif
slouken@0
   168
}
slouken@0
   169
slouken@0
   170
int X11_GL_CreateWindow(_THIS, int w, int h)
slouken@0
   171
{
slouken@0
   172
	int retval;
slouken@1361
   173
#if SDL_VIDEO_OPENGL_GLX
slouken@0
   174
	XSetWindowAttributes attributes;
slouken@0
   175
	unsigned long mask;
slouken@0
   176
	unsigned long black;
slouken@0
   177
slouken@0
   178
	black = (glx_visualinfo->visual == DefaultVisual(SDL_Display,
slouken@0
   179
						 	SDL_Screen))
slouken@0
   180
	       	? BlackPixel(SDL_Display, SDL_Screen) : 0;
slouken@0
   181
	attributes.background_pixel = black;
slouken@0
   182
	attributes.border_pixel = black;
slouken@0
   183
	attributes.colormap = SDL_XColorMap;
slouken@0
   184
	mask = CWBackPixel | CWBorderPixel | CWColormap;
slouken@0
   185
icculus@1168
   186
	SDL_Window = pXCreateWindow(SDL_Display, WMwindow,
slouken@0
   187
			0, 0, w, h, 0, glx_visualinfo->depth,
slouken@0
   188
			InputOutput, glx_visualinfo->visual,
slouken@0
   189
			mask, &attributes);
slouken@0
   190
	if ( !SDL_Window ) {
slouken@0
   191
		SDL_SetError("Could not create window");
slouken@0
   192
		return -1;
slouken@0
   193
	}
slouken@0
   194
	retval = 0;
slouken@0
   195
#else
slouken@0
   196
	SDL_SetError("X11 driver not configured with OpenGL");
slouken@0
   197
	retval = -1;
slouken@0
   198
#endif
slouken@0
   199
	return(retval);
slouken@0
   200
}
slouken@0
   201
slouken@0
   202
int X11_GL_CreateContext(_THIS)
slouken@0
   203
{
slouken@0
   204
	int retval;
slouken@1361
   205
#if SDL_VIDEO_OPENGL_GLX
slouken@0
   206
	/* We do this to create a clean separation between X and GLX errors. */
icculus@1168
   207
	pXSync( SDL_Display, False );
slouken@0
   208
	glx_context = this->gl_data->glXCreateContext(GFX_Display, 
slouken@0
   209
				     glx_visualinfo, NULL, True);
icculus@1168
   210
	pXSync( GFX_Display, False );
slouken@0
   211
slouken@0
   212
	if (glx_context == NULL) {
slouken@0
   213
		SDL_SetError("Could not create GL context");
slouken@0
   214
		return -1;
slouken@0
   215
	}
slouken@0
   216
slouken@0
   217
	gl_active = 1;
slouken@0
   218
#else
slouken@0
   219
	SDL_SetError("X11 driver not configured with OpenGL");
slouken@0
   220
#endif
slouken@0
   221
	if ( gl_active ) {
slouken@0
   222
		retval = 0;
slouken@0
   223
	} else {
slouken@0
   224
		retval = -1;
slouken@0
   225
	}
slouken@0
   226
	return(retval);
slouken@0
   227
}
slouken@0
   228
slouken@0
   229
void X11_GL_Shutdown(_THIS)
slouken@0
   230
{
slouken@1361
   231
#if SDL_VIDEO_OPENGL_GLX
slouken@0
   232
	/* Clean up OpenGL */
slouken@0
   233
	if( glx_context ) {
slouken@0
   234
		this->gl_data->glXMakeCurrent(GFX_Display, None, NULL);
slouken@0
   235
slouken@0
   236
		if (glx_context != NULL)
slouken@0
   237
			this->gl_data->glXDestroyContext(GFX_Display, glx_context);
slouken@0
   238
slouken@0
   239
		glx_context = NULL;
slouken@0
   240
	}
slouken@0
   241
	gl_active = 0;
slouken@1361
   242
#endif /* SDL_VIDEO_OPENGL_GLX */
slouken@0
   243
}
slouken@0
   244
slouken@1361
   245
#if SDL_VIDEO_OPENGL_GLX
slouken@0
   246
slouken@0
   247
/* Make the current context active */
slouken@0
   248
int X11_GL_MakeCurrent(_THIS)
slouken@0
   249
{
slouken@0
   250
	int retval;
slouken@638
   251
	
slouken@0
   252
	retval = 0;
slouken@0
   253
	if ( ! this->gl_data->glXMakeCurrent(GFX_Display,
slouken@0
   254
	                                     SDL_Window, glx_context) ) {
slouken@0
   255
		SDL_SetError("Unable to make GL context current");
slouken@0
   256
		retval = -1;
slouken@0
   257
	}
icculus@1168
   258
	pXSync( GFX_Display, False );
slouken@0
   259
slouken@0
   260
	/* More Voodoo X server workarounds... Grr... */
slouken@0
   261
	SDL_Lock_EventThread();
slouken@0
   262
	X11_CheckDGAMouse(this);
slouken@0
   263
	SDL_Unlock_EventThread();
slouken@0
   264
slouken@0
   265
	return(retval);
slouken@0
   266
}
slouken@0
   267
slouken@0
   268
/* Get attribute data from glX. */
slouken@0
   269
int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
slouken@0
   270
{
slouken@0
   271
	int retval;
slouken@0
   272
	int glx_attrib = None;
slouken@0
   273
slouken@0
   274
	switch( attrib ) {
slouken@0
   275
	    case SDL_GL_RED_SIZE:
slouken@0
   276
		glx_attrib = GLX_RED_SIZE;
slouken@0
   277
		break;
slouken@0
   278
	    case SDL_GL_GREEN_SIZE:
slouken@0
   279
		glx_attrib = GLX_GREEN_SIZE;
slouken@0
   280
		break;
slouken@0
   281
	    case SDL_GL_BLUE_SIZE:
slouken@0
   282
		glx_attrib = GLX_BLUE_SIZE;
slouken@0
   283
		break;
slouken@0
   284
	    case SDL_GL_ALPHA_SIZE:
slouken@0
   285
		glx_attrib = GLX_ALPHA_SIZE;
slouken@0
   286
		break;
slouken@0
   287
	    case SDL_GL_DOUBLEBUFFER:
slouken@0
   288
		glx_attrib = GLX_DOUBLEBUFFER;
slouken@0
   289
		break;
slouken@0
   290
	    case SDL_GL_BUFFER_SIZE:
slouken@0
   291
		glx_attrib = GLX_BUFFER_SIZE;
slouken@0
   292
		break;
slouken@0
   293
	    case SDL_GL_DEPTH_SIZE:
slouken@0
   294
		glx_attrib = GLX_DEPTH_SIZE;
slouken@0
   295
		break;
slouken@0
   296
	    case SDL_GL_STENCIL_SIZE:
slouken@0
   297
		glx_attrib = GLX_STENCIL_SIZE;
slouken@0
   298
		break;
slouken@0
   299
	    case SDL_GL_ACCUM_RED_SIZE:
slouken@0
   300
		glx_attrib = GLX_ACCUM_RED_SIZE;
slouken@0
   301
		break;
slouken@0
   302
	    case SDL_GL_ACCUM_GREEN_SIZE:
slouken@0
   303
		glx_attrib = GLX_ACCUM_GREEN_SIZE;
slouken@0
   304
		break;
slouken@0
   305
	    case SDL_GL_ACCUM_BLUE_SIZE:
slouken@0
   306
		glx_attrib = GLX_ACCUM_BLUE_SIZE;
slouken@0
   307
		break;
slouken@0
   308
	    case SDL_GL_ACCUM_ALPHA_SIZE:
slouken@0
   309
		glx_attrib = GLX_ACCUM_ALPHA_SIZE;
slouken@0
   310
		break;
slouken@450
   311
	    case SDL_GL_STEREO:
slouken@450
   312
		glx_attrib = GLX_STEREO;
slouken@450
   313
		break;
slouken@656
   314
 	    case SDL_GL_MULTISAMPLEBUFFERS:
slouken@655
   315
 		glx_attrib = GLX_SAMPLE_BUFFERS_ARB;
slouken@655
   316
 		break;
slouken@656
   317
 	    case SDL_GL_MULTISAMPLESAMPLES:
slouken@655
   318
 		glx_attrib = GLX_SAMPLES_ARB;
slouken@655
   319
 		break;
slouken@0
   320
	    default:
slouken@0
   321
		return(-1);
slouken@0
   322
	}
slouken@0
   323
slouken@0
   324
	retval = this->gl_data->glXGetConfig(GFX_Display, glx_visualinfo, glx_attrib, value);
slouken@0
   325
slouken@0
   326
	return retval;
slouken@0
   327
}
slouken@0
   328
slouken@0
   329
void X11_GL_SwapBuffers(_THIS)
slouken@0
   330
{
slouken@0
   331
	this->gl_data->glXSwapBuffers(GFX_Display, SDL_Window);
slouken@0
   332
}
slouken@0
   333
slouken@1361
   334
#endif /* SDL_VIDEO_OPENGL_GLX */
slouken@0
   335
slouken@0
   336
void X11_GL_UnloadLibrary(_THIS)
slouken@0
   337
{
slouken@1361
   338
#if SDL_VIDEO_OPENGL_GLX
slouken@0
   339
	if ( this->gl_config.driver_loaded ) {
icculus@1191
   340
icculus@1191
   341
		SDL_UnloadObject(this->gl_config.dll_handle);
slouken@0
   342
slouken@0
   343
		this->gl_data->glXGetProcAddress = NULL;
slouken@0
   344
		this->gl_data->glXChooseVisual = NULL;
slouken@0
   345
		this->gl_data->glXCreateContext = NULL;
slouken@0
   346
		this->gl_data->glXDestroyContext = NULL;
slouken@0
   347
		this->gl_data->glXMakeCurrent = NULL;
slouken@0
   348
		this->gl_data->glXSwapBuffers = NULL;
slouken@0
   349
slouken@0
   350
		this->gl_config.dll_handle = NULL;
slouken@0
   351
		this->gl_config.driver_loaded = 0;
slouken@0
   352
	}
slouken@0
   353
#endif
slouken@0
   354
}
slouken@0
   355
slouken@1361
   356
#if SDL_VIDEO_OPENGL_GLX
icculus@1182
   357
slouken@0
   358
/* Passing a NULL path means load pointers from the application */
slouken@0
   359
int X11_GL_LoadLibrary(_THIS, const char* path) 
slouken@0
   360
{
icculus@1191
   361
	void* handle = NULL;
slouken@0
   362
icculus@1182
   363
	if ( gl_active ) {
icculus@1182
   364
		SDL_SetError("OpenGL context already created");
icculus@1182
   365
		return -1;
icculus@1182
   366
	}
icculus@1182
   367
icculus@1182
   368
	if ( path == NULL ) {
slouken@1336
   369
		path = SDL_getenv("SDL_VIDEO_GL_DRIVER");
slouken@0
   370
		if ( path == NULL ) {
slouken@0
   371
			path = DEFAULT_OPENGL;
slouken@0
   372
		}
icculus@1191
   373
	}
icculus@1191
   374
slouken@1361
   375
	handle = SDL_LoadObject(path);
slouken@1361
   376
	if ( handle == NULL ) {
slouken@1361
   377
		/* SDL_LoadObject() will call SDL_SetError() for us. */
slouken@1361
   378
		return -1;
slouken@0
   379
	}
slouken@0
   380
slouken@0
   381
	/* Unload the old driver and reset the pointers */
slouken@0
   382
	X11_GL_UnloadLibrary(this);
slouken@0
   383
slouken@0
   384
	/* Load new function pointers */
slouken@180
   385
	this->gl_data->glXGetProcAddress =
slouken@1361
   386
		(void *(*)(const GLubyte *)) SDL_LoadFunction(handle, "glXGetProcAddressARB");
slouken@180
   387
	this->gl_data->glXChooseVisual =
slouken@1361
   388
		(XVisualInfo *(*)(Display *, int, int *)) SDL_LoadFunction(handle, "glXChooseVisual");
slouken@180
   389
	this->gl_data->glXCreateContext =
slouken@1361
   390
		(GLXContext (*)(Display *, XVisualInfo *, GLXContext, int)) SDL_LoadFunction(handle, "glXCreateContext");
slouken@180
   391
	this->gl_data->glXDestroyContext =
slouken@1361
   392
		(void (*)(Display *, GLXContext)) SDL_LoadFunction(handle, "glXDestroyContext");
slouken@180
   393
	this->gl_data->glXMakeCurrent =
slouken@1361
   394
		(int (*)(Display *, GLXDrawable, GLXContext)) SDL_LoadFunction(handle, "glXMakeCurrent");
slouken@180
   395
	this->gl_data->glXSwapBuffers =
slouken@1361
   396
		(void (*)(Display *, GLXDrawable)) SDL_LoadFunction(handle, "glXSwapBuffers");
slouken@180
   397
	this->gl_data->glXGetConfig =
slouken@1361
   398
		(int (*)(Display *, XVisualInfo *, int, int *)) SDL_LoadFunction(handle, "glXGetConfig");
slouken@638
   399
	this->gl_data->glXQueryExtensionsString =
slouken@1361
   400
		(const char *(*)(Display *, int)) SDL_LoadFunction(handle, "glXQueryExtensionsString");
slouken@638
   401
	
slouken@1315
   402
slouken@0
   403
	if ( (this->gl_data->glXChooseVisual == NULL) || 
slouken@0
   404
	     (this->gl_data->glXCreateContext == NULL) ||
slouken@0
   405
	     (this->gl_data->glXDestroyContext == NULL) ||
slouken@0
   406
	     (this->gl_data->glXMakeCurrent == NULL) ||
slouken@0
   407
	     (this->gl_data->glXSwapBuffers == NULL) ||
slouken@638
   408
	     (this->gl_data->glXGetConfig == NULL) ||
slouken@638
   409
	     (this->gl_data->glXQueryExtensionsString == NULL)) {
slouken@0
   410
		SDL_SetError("Could not retrieve OpenGL functions");
slouken@0
   411
		return -1;
slouken@0
   412
	}
slouken@0
   413
slouken@0
   414
	this->gl_config.dll_handle = handle;
slouken@0
   415
	this->gl_config.driver_loaded = 1;
slouken@0
   416
	if ( path ) {
slouken@1336
   417
		SDL_strncpy(this->gl_config.driver_path, path,
slouken@0
   418
			sizeof(this->gl_config.driver_path)-1);
slouken@0
   419
	} else {
slouken@1336
   420
		SDL_strcpy(this->gl_config.driver_path, "");
slouken@0
   421
	}
slouken@0
   422
	return 0;
slouken@0
   423
}
slouken@0
   424
slouken@0
   425
void *X11_GL_GetProcAddress(_THIS, const char* proc)
slouken@0
   426
{
slouken@0
   427
	void* handle;
slouken@0
   428
	
slouken@0
   429
	handle = this->gl_config.dll_handle;
slouken@0
   430
	if ( this->gl_data->glXGetProcAddress ) {
slouken@1196
   431
		return this->gl_data->glXGetProcAddress((const GLubyte *)proc);
slouken@0
   432
	}
slouken@1361
   433
	return SDL_LoadFunction(handle, proc);
slouken@0
   434
}
slouken@0
   435
slouken@1361
   436
#endif /* SDL_VIDEO_OPENGL_GLX */