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