Mercurial > sdl-ios-xcode
annotate src/video/x11/SDL_x11gl.c @ 3940:cb04355ffec4 SDL-1.2
Check correct glX extension name for swap_control, but it doesn't look like
we ever actually look up the symbol...that's probably a bug. :/
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Tue, 22 May 2007 22:15:54 +0000 |
parents | 0e0883cb7137 |
children | 5ec68276e4de |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1247
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1247
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
0 | 7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1247
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0 | 9 |
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 | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1247
diff
changeset
|
13 Lesser General Public License for more details. |
0 | 14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1247
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1247
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1247
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 18 |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
180
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1379
diff
changeset
|
22 #include "SDL_config.h" |
0 | 23 |
24 #include "SDL_x11video.h" | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
25 #include "../../events/SDL_events_c.h" |
0 | 26 #include "SDL_x11dga_c.h" |
27 #include "SDL_x11gl_c.h" | |
28 | |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1379
diff
changeset
|
29 #if defined(__IRIX__) |
862
f7a8b0ca2ae3
IRIX doesn't have a GL library versioning system
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
30 /* IRIX doesn't have a GL library versioning system */ |
f7a8b0ca2ae3
IRIX doesn't have a GL library versioning system
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
31 #define DEFAULT_OPENGL "libGL.so" |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1379
diff
changeset
|
32 #elif defined(__MACOSX__) |
1191
2bd4cec0de63
Seperate glX from HAVE_OPENGL, for platforms that have both an X server and
Ryan C. Gordon <icculus@icculus.org>
parents:
1182
diff
changeset
|
33 #define DEFAULT_OPENGL "/usr/X11R6/lib/libGL.1.dylib" |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1379
diff
changeset
|
34 #elif defined(__QNXNTO__) |
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1379
diff
changeset
|
35 #define DEFAULT_OPENGL "libGL.so.3" |
862
f7a8b0ca2ae3
IRIX doesn't have a GL library versioning system
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
36 #else |
0 | 37 #define DEFAULT_OPENGL "libGL.so.1" |
862
f7a8b0ca2ae3
IRIX doesn't have a GL library versioning system
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
38 #endif |
0 | 39 |
667
adbed8d7a991
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
656
diff
changeset
|
40 #ifndef GLX_ARB_multisample |
adbed8d7a991
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
656
diff
changeset
|
41 #define GLX_ARB_multisample |
adbed8d7a991
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
656
diff
changeset
|
42 #define GLX_SAMPLE_BUFFERS_ARB 100000 |
adbed8d7a991
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
656
diff
changeset
|
43 #define GLX_SAMPLES_ARB 100001 |
adbed8d7a991
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
656
diff
changeset
|
44 #endif |
adbed8d7a991
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
656
diff
changeset
|
45 |
1737 | 46 #ifndef GLX_EXT_visual_rating |
47 #define GLX_EXT_visual_rating | |
48 #define GLX_VISUAL_CAVEAT_EXT 0x20 | |
1841
0495a8e98595
Use the correct parameter for GLX_VISUAL_CAVEAT_EXT
Sam Lantinga <slouken@libsdl.org>
parents:
1737
diff
changeset
|
49 #define GLX_NONE_EXT 0x8000 |
1737 | 50 #define GLX_SLOW_VISUAL_EXT 0x8001 |
51 #define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D | |
52 #endif | |
53 | |
54 #if SDL_VIDEO_OPENGL_GLX | |
55 static int glXExtensionSupported(_THIS, const char *extension) | |
56 { | |
57 const char *extensions; | |
58 const char *start; | |
59 const char *where, *terminator; | |
60 | |
61 /* Extension names should not have spaces. */ | |
62 where = SDL_strchr(extension, ' '); | |
63 if ( where || *extension == '\0' ) { | |
64 return 0; | |
65 } | |
66 | |
67 extensions = this->gl_data->glXQueryExtensionsString(GFX_Display,SDL_Screen); | |
68 /* It takes a bit of care to be fool-proof about parsing the | |
69 * OpenGL extensions string. Don't be fooled by sub-strings, etc. | |
70 */ | |
71 | |
72 start = extensions; | |
73 | |
74 for (;;) { | |
75 where = SDL_strstr(start, extension); | |
76 if (!where) break; | |
77 | |
78 terminator = where + strlen(extension); | |
79 if (where == start || *(where - 1) == ' ') | |
80 if (*terminator == ' ' || *terminator == '\0') return 1; | |
81 | |
82 start = terminator; | |
83 } | |
84 return 0; | |
85 } | |
86 #endif /* SDL_VIDEO_OPENGL_GLX */ | |
87 | |
0 | 88 XVisualInfo *X11_GL_GetVisual(_THIS) |
89 { | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
90 #if SDL_VIDEO_OPENGL_GLX |
0 | 91 /* 64 seems nice. */ |
92 int attribs[64]; | |
93 int i; | |
94 | |
95 /* load the gl driver from a default path */ | |
96 if ( ! this->gl_config.driver_loaded ) { | |
97 /* no driver has been loaded, use default (ourselves) */ | |
98 if ( X11_GL_LoadLibrary(this, NULL) < 0 ) { | |
99 return NULL; | |
100 } | |
101 } | |
102 | |
103 /* See if we already have a window which we must use */ | |
104 if ( SDL_windowid ) { | |
105 XWindowAttributes a; | |
106 XVisualInfo vi_in; | |
107 int out_count; | |
108 | |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
109 XGetWindowAttributes(SDL_Display, SDL_Window, &a); |
0 | 110 vi_in.screen = SDL_Screen; |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
111 vi_in.visualid = XVisualIDFromVisual(a.visual); |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
112 glx_visualinfo = XGetVisualInfo(SDL_Display, |
0 | 113 VisualScreenMask|VisualIDMask, &vi_in, &out_count); |
114 return glx_visualinfo; | |
115 } | |
116 | |
117 /* Setup our GLX attributes according to the gl_config. */ | |
450
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
118 i = 0; |
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
119 attribs[i++] = GLX_RGBA; |
0 | 120 attribs[i++] = GLX_RED_SIZE; |
121 attribs[i++] = this->gl_config.red_size; | |
122 attribs[i++] = GLX_GREEN_SIZE; | |
123 attribs[i++] = this->gl_config.green_size; | |
124 attribs[i++] = GLX_BLUE_SIZE; | |
125 attribs[i++] = this->gl_config.blue_size; | |
126 | |
127 if( this->gl_config.alpha_size ) { | |
128 attribs[i++] = GLX_ALPHA_SIZE; | |
129 attribs[i++] = this->gl_config.alpha_size; | |
130 } | |
131 | |
132 if( this->gl_config.buffer_size ) { | |
450
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
133 attribs[i++] = GLX_BUFFER_SIZE; |
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
134 attribs[i++] = this->gl_config.buffer_size; |
0 | 135 } |
136 | |
137 if( this->gl_config.double_buffer ) { | |
138 attribs[i++] = GLX_DOUBLEBUFFER; | |
139 } | |
140 | |
141 attribs[i++] = GLX_DEPTH_SIZE; | |
142 attribs[i++] = this->gl_config.depth_size; | |
143 | |
144 if( this->gl_config.stencil_size ) { | |
145 attribs[i++] = GLX_STENCIL_SIZE; | |
146 attribs[i++] = this->gl_config.stencil_size; | |
147 } | |
148 | |
149 if( this->gl_config.accum_red_size ) { | |
450
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
150 attribs[i++] = GLX_ACCUM_RED_SIZE; |
0 | 151 attribs[i++] = this->gl_config.accum_red_size; |
152 } | |
153 | |
154 if( this->gl_config.accum_green_size ) { | |
450
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
155 attribs[i++] = GLX_ACCUM_GREEN_SIZE; |
0 | 156 attribs[i++] = this->gl_config.accum_green_size; |
157 } | |
158 | |
159 if( this->gl_config.accum_blue_size ) { | |
450
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
160 attribs[i++] = GLX_ACCUM_BLUE_SIZE; |
0 | 161 attribs[i++] = this->gl_config.accum_blue_size; |
162 } | |
163 | |
164 if( this->gl_config.accum_alpha_size ) { | |
450
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
165 attribs[i++] = GLX_ACCUM_ALPHA_SIZE; |
0 | 166 attribs[i++] = this->gl_config.accum_alpha_size; |
167 } | |
168 | |
450
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
169 if( this->gl_config.stereo ) { |
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
170 attribs[i++] = GLX_STEREO; |
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
171 } |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
646
diff
changeset
|
172 |
656
864e2d2a9a55
Merged in Ryan's multisample code for MacOS, and changed the constants to match.
Sam Lantinga <slouken@libsdl.org>
parents:
655
diff
changeset
|
173 if( this->gl_config.multisamplebuffers ) { |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
646
diff
changeset
|
174 attribs[i++] = GLX_SAMPLE_BUFFERS_ARB; |
656
864e2d2a9a55
Merged in Ryan's multisample code for MacOS, and changed the constants to match.
Sam Lantinga <slouken@libsdl.org>
parents:
655
diff
changeset
|
175 attribs[i++] = this->gl_config.multisamplebuffers; |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
646
diff
changeset
|
176 } |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
646
diff
changeset
|
177 |
656
864e2d2a9a55
Merged in Ryan's multisample code for MacOS, and changed the constants to match.
Sam Lantinga <slouken@libsdl.org>
parents:
655
diff
changeset
|
178 if( this->gl_config.multisamplesamples ) { |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
646
diff
changeset
|
179 attribs[i++] = GLX_SAMPLES_ARB; |
656
864e2d2a9a55
Merged in Ryan's multisample code for MacOS, and changed the constants to match.
Sam Lantinga <slouken@libsdl.org>
parents:
655
diff
changeset
|
180 attribs[i++] = this->gl_config.multisamplesamples; |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
646
diff
changeset
|
181 } |
450
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
182 |
1737 | 183 if( this->gl_config.accelerated >= 0 && |
184 glXExtensionSupported(this, "GLX_EXT_visual_rating") ) { | |
185 attribs[i++] = GLX_VISUAL_CAVEAT_EXT; | |
1841
0495a8e98595
Use the correct parameter for GLX_VISUAL_CAVEAT_EXT
Sam Lantinga <slouken@libsdl.org>
parents:
1737
diff
changeset
|
186 attribs[i++] = GLX_NONE_EXT; |
1737 | 187 } |
188 | |
0 | 189 #ifdef GLX_DIRECT_COLOR /* Try for a DirectColor visual for gamma support */ |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1315
diff
changeset
|
190 if ( !SDL_getenv("SDL_VIDEO_X11_NODIRECTCOLOR") ) { |
1060
86885b40a53b
Support SDL_VIDEO_X11_NODIRECTCOLOR for OpenGL visuals
Sam Lantinga <slouken@libsdl.org>
parents:
862
diff
changeset
|
191 attribs[i++] = GLX_X_VISUAL_TYPE; |
86885b40a53b
Support SDL_VIDEO_X11_NODIRECTCOLOR for OpenGL visuals
Sam Lantinga <slouken@libsdl.org>
parents:
862
diff
changeset
|
192 attribs[i++] = GLX_DIRECT_COLOR; |
86885b40a53b
Support SDL_VIDEO_X11_NODIRECTCOLOR for OpenGL visuals
Sam Lantinga <slouken@libsdl.org>
parents:
862
diff
changeset
|
193 } |
0 | 194 #endif |
195 attribs[i++] = None; | |
196 | |
197 glx_visualinfo = this->gl_data->glXChooseVisual(GFX_Display, | |
198 SDL_Screen, attribs); | |
199 #ifdef GLX_DIRECT_COLOR | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1315
diff
changeset
|
200 if( !glx_visualinfo && !SDL_getenv("SDL_VIDEO_X11_NODIRECTCOLOR") ) { /* No DirectColor visual? Try again.. */ |
0 | 201 attribs[i-3] = None; |
202 glx_visualinfo = this->gl_data->glXChooseVisual(GFX_Display, | |
203 SDL_Screen, attribs); | |
204 } | |
205 #endif | |
206 if( !glx_visualinfo ) { | |
207 SDL_SetError( "Couldn't find matching GLX visual"); | |
208 return NULL; | |
209 } | |
1315
e94b0d7c33bc
Merged useful fixes from 1.3 branch
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
210 /* |
e94b0d7c33bc
Merged useful fixes from 1.3 branch
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
211 printf("Found GLX visual 0x%x\n", glx_visualinfo->visualid); |
e94b0d7c33bc
Merged useful fixes from 1.3 branch
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
212 */ |
0 | 213 return glx_visualinfo; |
214 #else | |
215 SDL_SetError("X11 driver not configured with OpenGL"); | |
216 return NULL; | |
217 #endif | |
218 } | |
219 | |
220 int X11_GL_CreateWindow(_THIS, int w, int h) | |
221 { | |
222 int retval; | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
223 #if SDL_VIDEO_OPENGL_GLX |
0 | 224 XSetWindowAttributes attributes; |
225 unsigned long mask; | |
226 unsigned long black; | |
227 | |
228 black = (glx_visualinfo->visual == DefaultVisual(SDL_Display, | |
229 SDL_Screen)) | |
230 ? BlackPixel(SDL_Display, SDL_Screen) : 0; | |
231 attributes.background_pixel = black; | |
232 attributes.border_pixel = black; | |
233 attributes.colormap = SDL_XColorMap; | |
234 mask = CWBackPixel | CWBorderPixel | CWColormap; | |
235 | |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
236 SDL_Window = XCreateWindow(SDL_Display, WMwindow, |
0 | 237 0, 0, w, h, 0, glx_visualinfo->depth, |
238 InputOutput, glx_visualinfo->visual, | |
239 mask, &attributes); | |
240 if ( !SDL_Window ) { | |
241 SDL_SetError("Could not create window"); | |
242 return -1; | |
243 } | |
244 retval = 0; | |
245 #else | |
246 SDL_SetError("X11 driver not configured with OpenGL"); | |
247 retval = -1; | |
248 #endif | |
249 return(retval); | |
250 } | |
251 | |
252 int X11_GL_CreateContext(_THIS) | |
253 { | |
254 int retval; | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
255 #if SDL_VIDEO_OPENGL_GLX |
1736
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
256 |
0 | 257 /* We do this to create a clean separation between X and GLX errors. */ |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
258 XSync( SDL_Display, False ); |
0 | 259 glx_context = this->gl_data->glXCreateContext(GFX_Display, |
260 glx_visualinfo, NULL, True); | |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
261 XSync( GFX_Display, False ); |
0 | 262 |
1736
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
263 if ( glx_context == NULL ) { |
0 | 264 SDL_SetError("Could not create GL context"); |
1736
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
265 return(-1); |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
266 } |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
267 if ( X11_GL_MakeCurrent(this) < 0 ) { |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
268 return(-1); |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
269 } |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
270 gl_active = 1; |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
271 |
3940
cb04355ffec4
Check correct glX extension name for swap_control, but it doesn't look like
Ryan C. Gordon <icculus@icculus.org>
parents:
3905
diff
changeset
|
272 if ( !glXExtensionSupported(this, "GLX_SGI_swap_control") ) { |
1736
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
273 this->gl_data->glXSwapIntervalSGI = NULL; |
0 | 274 } |
1737 | 275 if ( !glXExtensionSupported(this, "GLX_MESA_swap_control") ) { |
1736
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
276 this->gl_data->glXSwapIntervalMESA = NULL; |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
277 this->gl_data->glXGetSwapIntervalMESA = NULL; |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
278 } |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
279 if ( this->gl_config.swap_control >= 0 ) { |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
280 if ( this->gl_data->glXSwapIntervalMESA ) { |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
281 this->gl_data->glXSwapIntervalMESA(this->gl_config.swap_control); |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
282 } else if ( this->gl_data->glXSwapIntervalSGI ) { |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
283 this->gl_data->glXSwapIntervalSGI(this->gl_config.swap_control); |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
284 } |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
285 } |
0 | 286 #else |
287 SDL_SetError("X11 driver not configured with OpenGL"); | |
288 #endif | |
289 if ( gl_active ) { | |
290 retval = 0; | |
291 } else { | |
292 retval = -1; | |
293 } | |
294 return(retval); | |
295 } | |
296 | |
297 void X11_GL_Shutdown(_THIS) | |
298 { | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
299 #if SDL_VIDEO_OPENGL_GLX |
0 | 300 /* Clean up OpenGL */ |
301 if( glx_context ) { | |
302 this->gl_data->glXMakeCurrent(GFX_Display, None, NULL); | |
303 | |
304 if (glx_context != NULL) | |
305 this->gl_data->glXDestroyContext(GFX_Display, glx_context); | |
306 | |
307 glx_context = NULL; | |
308 } | |
309 gl_active = 0; | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
310 #endif /* SDL_VIDEO_OPENGL_GLX */ |
0 | 311 } |
312 | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
313 #if SDL_VIDEO_OPENGL_GLX |
0 | 314 |
315 /* Make the current context active */ | |
316 int X11_GL_MakeCurrent(_THIS) | |
317 { | |
318 int retval; | |
638
b0108e9dea53
Date: Sun, 11 May 2003 19:59:06 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
566
diff
changeset
|
319 |
0 | 320 retval = 0; |
321 if ( ! this->gl_data->glXMakeCurrent(GFX_Display, | |
322 SDL_Window, glx_context) ) { | |
323 SDL_SetError("Unable to make GL context current"); | |
324 retval = -1; | |
325 } | |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
326 XSync( GFX_Display, False ); |
0 | 327 |
328 /* More Voodoo X server workarounds... Grr... */ | |
329 SDL_Lock_EventThread(); | |
330 X11_CheckDGAMouse(this); | |
331 SDL_Unlock_EventThread(); | |
332 | |
333 return(retval); | |
334 } | |
335 | |
336 /* Get attribute data from glX. */ | |
337 int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value) | |
338 { | |
339 int retval; | |
340 int glx_attrib = None; | |
341 | |
342 switch( attrib ) { | |
343 case SDL_GL_RED_SIZE: | |
344 glx_attrib = GLX_RED_SIZE; | |
345 break; | |
346 case SDL_GL_GREEN_SIZE: | |
347 glx_attrib = GLX_GREEN_SIZE; | |
348 break; | |
349 case SDL_GL_BLUE_SIZE: | |
350 glx_attrib = GLX_BLUE_SIZE; | |
351 break; | |
352 case SDL_GL_ALPHA_SIZE: | |
353 glx_attrib = GLX_ALPHA_SIZE; | |
354 break; | |
355 case SDL_GL_DOUBLEBUFFER: | |
356 glx_attrib = GLX_DOUBLEBUFFER; | |
357 break; | |
358 case SDL_GL_BUFFER_SIZE: | |
359 glx_attrib = GLX_BUFFER_SIZE; | |
360 break; | |
361 case SDL_GL_DEPTH_SIZE: | |
362 glx_attrib = GLX_DEPTH_SIZE; | |
363 break; | |
364 case SDL_GL_STENCIL_SIZE: | |
365 glx_attrib = GLX_STENCIL_SIZE; | |
366 break; | |
367 case SDL_GL_ACCUM_RED_SIZE: | |
368 glx_attrib = GLX_ACCUM_RED_SIZE; | |
369 break; | |
370 case SDL_GL_ACCUM_GREEN_SIZE: | |
371 glx_attrib = GLX_ACCUM_GREEN_SIZE; | |
372 break; | |
373 case SDL_GL_ACCUM_BLUE_SIZE: | |
374 glx_attrib = GLX_ACCUM_BLUE_SIZE; | |
375 break; | |
376 case SDL_GL_ACCUM_ALPHA_SIZE: | |
377 glx_attrib = GLX_ACCUM_ALPHA_SIZE; | |
378 break; | |
450
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
379 case SDL_GL_STEREO: |
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
380 glx_attrib = GLX_STEREO; |
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
381 break; |
656
864e2d2a9a55
Merged in Ryan's multisample code for MacOS, and changed the constants to match.
Sam Lantinga <slouken@libsdl.org>
parents:
655
diff
changeset
|
382 case SDL_GL_MULTISAMPLEBUFFERS: |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
646
diff
changeset
|
383 glx_attrib = GLX_SAMPLE_BUFFERS_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
646
diff
changeset
|
384 break; |
656
864e2d2a9a55
Merged in Ryan's multisample code for MacOS, and changed the constants to match.
Sam Lantinga <slouken@libsdl.org>
parents:
655
diff
changeset
|
385 case SDL_GL_MULTISAMPLESAMPLES: |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
646
diff
changeset
|
386 glx_attrib = GLX_SAMPLES_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
646
diff
changeset
|
387 break; |
1737 | 388 case SDL_GL_ACCELERATED_VISUAL: |
389 if ( glXExtensionSupported(this, "GLX_EXT_visual_rating") ) { | |
390 glx_attrib = GLX_VISUAL_CAVEAT_EXT; | |
391 retval = this->gl_data->glXGetConfig(GFX_Display, glx_visualinfo, glx_attrib, value); | |
392 if ( *value == GLX_SLOW_VISUAL_EXT ) { | |
393 *value = SDL_FALSE; | |
394 } else { | |
395 *value = SDL_TRUE; | |
396 } | |
397 return retval; | |
398 } else { | |
399 return(-1); | |
400 } | |
401 break; | |
1736
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
402 case SDL_GL_SWAP_CONTROL: |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
403 if ( this->gl_data->glXGetSwapIntervalMESA ) { |
1880 | 404 *value = this->gl_data->glXGetSwapIntervalMESA(); |
405 return(0); | |
1736
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
406 } else { |
1880 | 407 return(-1); |
1736
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
408 } |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
409 break; |
0 | 410 default: |
411 return(-1); | |
412 } | |
413 | |
414 retval = this->gl_data->glXGetConfig(GFX_Display, glx_visualinfo, glx_attrib, value); | |
415 | |
416 return retval; | |
417 } | |
418 | |
419 void X11_GL_SwapBuffers(_THIS) | |
420 { | |
421 this->gl_data->glXSwapBuffers(GFX_Display, SDL_Window); | |
422 } | |
423 | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
424 #endif /* SDL_VIDEO_OPENGL_GLX */ |
0 | 425 |
1861 | 426 #define OPENGL_REQUIRS_DLOPEN |
427 #if defined(OPENGL_REQUIRS_DLOPEN) && defined(SDL_LOADSO_DLOPEN) | |
428 #include <dlfcn.h> | |
429 #define GL_LoadObject(X) dlopen(X, (RTLD_NOW|RTLD_GLOBAL)) | |
430 #define GL_LoadFunction dlsym | |
431 #define GL_UnloadObject dlclose | |
432 #else | |
433 #define GL_LoadObject SDL_LoadObject | |
434 #define GL_LoadFunction SDL_LoadFunction | |
435 #define GL_UnloadObject SDL_UnloadObject | |
436 #endif | |
437 | |
0 | 438 void X11_GL_UnloadLibrary(_THIS) |
439 { | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
440 #if SDL_VIDEO_OPENGL_GLX |
0 | 441 if ( this->gl_config.driver_loaded ) { |
1191
2bd4cec0de63
Seperate glX from HAVE_OPENGL, for platforms that have both an X server and
Ryan C. Gordon <icculus@icculus.org>
parents:
1182
diff
changeset
|
442 |
1861 | 443 GL_UnloadObject(this->gl_config.dll_handle); |
0 | 444 |
445 this->gl_data->glXGetProcAddress = NULL; | |
446 this->gl_data->glXChooseVisual = NULL; | |
447 this->gl_data->glXCreateContext = NULL; | |
448 this->gl_data->glXDestroyContext = NULL; | |
449 this->gl_data->glXMakeCurrent = NULL; | |
450 this->gl_data->glXSwapBuffers = NULL; | |
1736
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
451 this->gl_data->glXSwapIntervalSGI = NULL; |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
452 this->gl_data->glXSwapIntervalMESA = NULL; |
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
453 this->gl_data->glXGetSwapIntervalMESA = NULL; |
0 | 454 |
455 this->gl_config.dll_handle = NULL; | |
456 this->gl_config.driver_loaded = 0; | |
457 } | |
458 #endif | |
459 } | |
460 | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
461 #if SDL_VIDEO_OPENGL_GLX |
1182
e8e8dcb68e7a
X11 driver now chooses "libGL.so.1" as a default when a NULL is passed to
Ryan C. Gordon <icculus@icculus.org>
parents:
1168
diff
changeset
|
462 |
0 | 463 /* Passing a NULL path means load pointers from the application */ |
464 int X11_GL_LoadLibrary(_THIS, const char* path) | |
465 { | |
1191
2bd4cec0de63
Seperate glX from HAVE_OPENGL, for platforms that have both an X server and
Ryan C. Gordon <icculus@icculus.org>
parents:
1182
diff
changeset
|
466 void* handle = NULL; |
0 | 467 |
1182
e8e8dcb68e7a
X11 driver now chooses "libGL.so.1" as a default when a NULL is passed to
Ryan C. Gordon <icculus@icculus.org>
parents:
1168
diff
changeset
|
468 if ( gl_active ) { |
e8e8dcb68e7a
X11 driver now chooses "libGL.so.1" as a default when a NULL is passed to
Ryan C. Gordon <icculus@icculus.org>
parents:
1168
diff
changeset
|
469 SDL_SetError("OpenGL context already created"); |
e8e8dcb68e7a
X11 driver now chooses "libGL.so.1" as a default when a NULL is passed to
Ryan C. Gordon <icculus@icculus.org>
parents:
1168
diff
changeset
|
470 return -1; |
e8e8dcb68e7a
X11 driver now chooses "libGL.so.1" as a default when a NULL is passed to
Ryan C. Gordon <icculus@icculus.org>
parents:
1168
diff
changeset
|
471 } |
e8e8dcb68e7a
X11 driver now chooses "libGL.so.1" as a default when a NULL is passed to
Ryan C. Gordon <icculus@icculus.org>
parents:
1168
diff
changeset
|
472 |
e8e8dcb68e7a
X11 driver now chooses "libGL.so.1" as a default when a NULL is passed to
Ryan C. Gordon <icculus@icculus.org>
parents:
1168
diff
changeset
|
473 if ( path == NULL ) { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1315
diff
changeset
|
474 path = SDL_getenv("SDL_VIDEO_GL_DRIVER"); |
0 | 475 if ( path == NULL ) { |
476 path = DEFAULT_OPENGL; | |
477 } | |
1191
2bd4cec0de63
Seperate glX from HAVE_OPENGL, for platforms that have both an X server and
Ryan C. Gordon <icculus@icculus.org>
parents:
1182
diff
changeset
|
478 } |
2bd4cec0de63
Seperate glX from HAVE_OPENGL, for platforms that have both an X server and
Ryan C. Gordon <icculus@icculus.org>
parents:
1182
diff
changeset
|
479 |
1861 | 480 handle = GL_LoadObject(path); |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
481 if ( handle == NULL ) { |
3905
0e0883cb7137
Add error message if not using SDL_LoadObject
Patrice Mandin <patmandin@gmail.com>
parents:
1880
diff
changeset
|
482 #if defined(OPENGL_REQUIRS_DLOPEN) && defined(SDL_LOADSO_DLOPEN) |
0e0883cb7137
Add error message if not using SDL_LoadObject
Patrice Mandin <patmandin@gmail.com>
parents:
1880
diff
changeset
|
483 SDL_SetError("Failed loading %s", path); |
0e0883cb7137
Add error message if not using SDL_LoadObject
Patrice Mandin <patmandin@gmail.com>
parents:
1880
diff
changeset
|
484 #else |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
485 /* SDL_LoadObject() will call SDL_SetError() for us. */ |
3905
0e0883cb7137
Add error message if not using SDL_LoadObject
Patrice Mandin <patmandin@gmail.com>
parents:
1880
diff
changeset
|
486 #endif |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
487 return -1; |
0 | 488 } |
489 | |
490 /* Unload the old driver and reset the pointers */ | |
491 X11_GL_UnloadLibrary(this); | |
492 | |
493 /* Load new function pointers */ | |
180
578815880307
Do proper typecasting so this compiles on IRIX
Sam Lantinga <slouken@libsdl.org>
parents:
127
diff
changeset
|
494 this->gl_data->glXGetProcAddress = |
1861 | 495 (void *(*)(const GLubyte *)) GL_LoadFunction(handle, "glXGetProcAddressARB"); |
180
578815880307
Do proper typecasting so this compiles on IRIX
Sam Lantinga <slouken@libsdl.org>
parents:
127
diff
changeset
|
496 this->gl_data->glXChooseVisual = |
1861 | 497 (XVisualInfo *(*)(Display *, int, int *)) GL_LoadFunction(handle, "glXChooseVisual"); |
180
578815880307
Do proper typecasting so this compiles on IRIX
Sam Lantinga <slouken@libsdl.org>
parents:
127
diff
changeset
|
498 this->gl_data->glXCreateContext = |
1861 | 499 (GLXContext (*)(Display *, XVisualInfo *, GLXContext, int)) GL_LoadFunction(handle, "glXCreateContext"); |
180
578815880307
Do proper typecasting so this compiles on IRIX
Sam Lantinga <slouken@libsdl.org>
parents:
127
diff
changeset
|
500 this->gl_data->glXDestroyContext = |
1861 | 501 (void (*)(Display *, GLXContext)) GL_LoadFunction(handle, "glXDestroyContext"); |
180
578815880307
Do proper typecasting so this compiles on IRIX
Sam Lantinga <slouken@libsdl.org>
parents:
127
diff
changeset
|
502 this->gl_data->glXMakeCurrent = |
1861 | 503 (int (*)(Display *, GLXDrawable, GLXContext)) GL_LoadFunction(handle, "glXMakeCurrent"); |
180
578815880307
Do proper typecasting so this compiles on IRIX
Sam Lantinga <slouken@libsdl.org>
parents:
127
diff
changeset
|
504 this->gl_data->glXSwapBuffers = |
1861 | 505 (void (*)(Display *, GLXDrawable)) GL_LoadFunction(handle, "glXSwapBuffers"); |
180
578815880307
Do proper typecasting so this compiles on IRIX
Sam Lantinga <slouken@libsdl.org>
parents:
127
diff
changeset
|
506 this->gl_data->glXGetConfig = |
1861 | 507 (int (*)(Display *, XVisualInfo *, int, int *)) GL_LoadFunction(handle, "glXGetConfig"); |
638
b0108e9dea53
Date: Sun, 11 May 2003 19:59:06 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
566
diff
changeset
|
508 this->gl_data->glXQueryExtensionsString = |
1861 | 509 (const char *(*)(Display *, int)) GL_LoadFunction(handle, "glXQueryExtensionsString"); |
1736
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
510 this->gl_data->glXSwapIntervalSGI = |
1861 | 511 (int (*)(int)) GL_LoadFunction(handle, "glXSwapIntervalSGI"); |
1736
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
512 this->gl_data->glXSwapIntervalMESA = |
1861 | 513 (GLint (*)(unsigned)) GL_LoadFunction(handle, "glXSwapIntervalMESA"); |
1736
3b2a92126f4d
Implemented bug #2, 117:
Sam Lantinga <slouken@libsdl.org>
parents:
1577
diff
changeset
|
514 this->gl_data->glXGetSwapIntervalMESA = |
1861 | 515 (GLint (*)(void)) GL_LoadFunction(handle, "glXGetSwapIntervalMESA"); |
1315
e94b0d7c33bc
Merged useful fixes from 1.3 branch
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
516 |
0 | 517 if ( (this->gl_data->glXChooseVisual == NULL) || |
518 (this->gl_data->glXCreateContext == NULL) || | |
519 (this->gl_data->glXDestroyContext == NULL) || | |
520 (this->gl_data->glXMakeCurrent == NULL) || | |
521 (this->gl_data->glXSwapBuffers == NULL) || | |
638
b0108e9dea53
Date: Sun, 11 May 2003 19:59:06 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
566
diff
changeset
|
522 (this->gl_data->glXGetConfig == NULL) || |
b0108e9dea53
Date: Sun, 11 May 2003 19:59:06 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
566
diff
changeset
|
523 (this->gl_data->glXQueryExtensionsString == NULL)) { |
0 | 524 SDL_SetError("Could not retrieve OpenGL functions"); |
525 return -1; | |
526 } | |
527 | |
528 this->gl_config.dll_handle = handle; | |
529 this->gl_config.driver_loaded = 1; | |
530 if ( path ) { | |
1379
c0a74f199ecf
Use only safe string functions
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
531 SDL_strlcpy(this->gl_config.driver_path, path, |
c0a74f199ecf
Use only safe string functions
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
532 SDL_arraysize(this->gl_config.driver_path)); |
0 | 533 } else { |
1379
c0a74f199ecf
Use only safe string functions
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
534 *this->gl_config.driver_path = '\0'; |
0 | 535 } |
536 return 0; | |
537 } | |
538 | |
539 void *X11_GL_GetProcAddress(_THIS, const char* proc) | |
540 { | |
541 void* handle; | |
542 | |
543 handle = this->gl_config.dll_handle; | |
544 if ( this->gl_data->glXGetProcAddress ) { | |
1196
b81f54c3963f
Fixed compile warnings with gcc 4
Sam Lantinga <slouken@libsdl.org>
parents:
1191
diff
changeset
|
545 return this->gl_data->glXGetProcAddress((const GLubyte *)proc); |
0 | 546 } |
1861 | 547 return GL_LoadFunction(handle, proc); |
0 | 548 } |
549 | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
550 #endif /* SDL_VIDEO_OPENGL_GLX */ |