Mercurial > sdl-ios-xcode
annotate src/video/x11/SDL_x11gl.c @ 1358:c71e05b4dc2e
More header massaging... works great on Windows. ;-)
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 10 Feb 2006 06:48:43 +0000 |
parents | 604d73db6802 |
children | 19418e4422cb |
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 */ |
22 | |
23 #include "SDL_x11video.h" | |
1338
604d73db6802
Removed uses of stdlib.h and string.h
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
24 #include "SDL_events_c.h" |
0 | 25 #include "SDL_x11dga_c.h" |
26 #include "SDL_x11gl_c.h" | |
27 | |
862
f7a8b0ca2ae3
IRIX doesn't have a GL library versioning system
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
28 #if defined(sgi) |
f7a8b0ca2ae3
IRIX doesn't have a GL library versioning system
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
29 /* 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
|
30 #define DEFAULT_OPENGL "libGL.so" |
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
|
31 #elif defined(MACOSX) |
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
|
32 #define DEFAULT_OPENGL "/usr/X11R6/lib/libGL.1.dylib" |
862
f7a8b0ca2ae3
IRIX doesn't have a GL library versioning system
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
33 #else |
0 | 34 #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
|
35 #endif |
0 | 36 |
667
adbed8d7a991
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
656
diff
changeset
|
37 #ifndef GLX_ARB_multisample |
adbed8d7a991
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
656
diff
changeset
|
38 #define GLX_ARB_multisample |
adbed8d7a991
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
656
diff
changeset
|
39 #define GLX_SAMPLE_BUFFERS_ARB 100000 |
adbed8d7a991
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
656
diff
changeset
|
40 #define GLX_SAMPLES_ARB 100001 |
adbed8d7a991
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
656
diff
changeset
|
41 #endif |
adbed8d7a991
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
656
diff
changeset
|
42 |
0 | 43 XVisualInfo *X11_GL_GetVisual(_THIS) |
44 { | |
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
|
45 #ifdef HAVE_OPENGL_X11 |
0 | 46 /* 64 seems nice. */ |
47 int attribs[64]; | |
48 int i; | |
49 | |
50 /* load the gl driver from a default path */ | |
51 if ( ! this->gl_config.driver_loaded ) { | |
52 /* no driver has been loaded, use default (ourselves) */ | |
53 if ( X11_GL_LoadLibrary(this, NULL) < 0 ) { | |
54 return NULL; | |
55 } | |
56 } | |
57 | |
58 /* See if we already have a window which we must use */ | |
59 if ( SDL_windowid ) { | |
60 XWindowAttributes a; | |
61 XVisualInfo vi_in; | |
62 int out_count; | |
63 | |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
1060
diff
changeset
|
64 pXGetWindowAttributes(SDL_Display, SDL_Window, &a); |
0 | 65 vi_in.screen = SDL_Screen; |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
1060
diff
changeset
|
66 vi_in.visualid = pXVisualIDFromVisual(a.visual); |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
1060
diff
changeset
|
67 glx_visualinfo = pXGetVisualInfo(SDL_Display, |
0 | 68 VisualScreenMask|VisualIDMask, &vi_in, &out_count); |
69 return glx_visualinfo; | |
70 } | |
71 | |
72 /* 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
|
73 i = 0; |
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
74 attribs[i++] = GLX_RGBA; |
0 | 75 attribs[i++] = GLX_RED_SIZE; |
76 attribs[i++] = this->gl_config.red_size; | |
77 attribs[i++] = GLX_GREEN_SIZE; | |
78 attribs[i++] = this->gl_config.green_size; | |
79 attribs[i++] = GLX_BLUE_SIZE; | |
80 attribs[i++] = this->gl_config.blue_size; | |
81 | |
82 if( this->gl_config.alpha_size ) { | |
83 attribs[i++] = GLX_ALPHA_SIZE; | |
84 attribs[i++] = this->gl_config.alpha_size; | |
85 } | |
86 | |
87 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
|
88 attribs[i++] = GLX_BUFFER_SIZE; |
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
89 attribs[i++] = this->gl_config.buffer_size; |
0 | 90 } |
91 | |
92 if( this->gl_config.double_buffer ) { | |
93 attribs[i++] = GLX_DOUBLEBUFFER; | |
94 } | |
95 | |
96 attribs[i++] = GLX_DEPTH_SIZE; | |
97 attribs[i++] = this->gl_config.depth_size; | |
98 | |
99 if( this->gl_config.stencil_size ) { | |
100 attribs[i++] = GLX_STENCIL_SIZE; | |
101 attribs[i++] = this->gl_config.stencil_size; | |
102 } | |
103 | |
104 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
|
105 attribs[i++] = GLX_ACCUM_RED_SIZE; |
0 | 106 attribs[i++] = this->gl_config.accum_red_size; |
107 } | |
108 | |
109 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
|
110 attribs[i++] = GLX_ACCUM_GREEN_SIZE; |
0 | 111 attribs[i++] = this->gl_config.accum_green_size; |
112 } | |
113 | |
114 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
|
115 attribs[i++] = GLX_ACCUM_BLUE_SIZE; |
0 | 116 attribs[i++] = this->gl_config.accum_blue_size; |
117 } | |
118 | |
119 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
|
120 attribs[i++] = GLX_ACCUM_ALPHA_SIZE; |
0 | 121 attribs[i++] = this->gl_config.accum_alpha_size; |
122 } | |
123 | |
450
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
124 if( this->gl_config.stereo ) { |
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
125 attribs[i++] = GLX_STEREO; |
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
126 attribs[i++] = this->gl_config.stereo; |
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
127 } |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
646
diff
changeset
|
128 |
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
|
129 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
|
130 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
|
131 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
|
132 } |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
646
diff
changeset
|
133 |
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
|
134 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
|
135 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
|
136 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
|
137 } |
450
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
138 |
0 | 139 #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
|
140 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
|
141 attribs[i++] = GLX_X_VISUAL_TYPE; |
86885b40a53b
Support SDL_VIDEO_X11_NODIRECTCOLOR for OpenGL visuals
Sam Lantinga <slouken@libsdl.org>
parents:
862
diff
changeset
|
142 attribs[i++] = GLX_DIRECT_COLOR; |
86885b40a53b
Support SDL_VIDEO_X11_NODIRECTCOLOR for OpenGL visuals
Sam Lantinga <slouken@libsdl.org>
parents:
862
diff
changeset
|
143 } |
0 | 144 #endif |
145 attribs[i++] = None; | |
146 | |
147 glx_visualinfo = this->gl_data->glXChooseVisual(GFX_Display, | |
148 SDL_Screen, attribs); | |
149 #ifdef GLX_DIRECT_COLOR | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1315
diff
changeset
|
150 if( !glx_visualinfo && !SDL_getenv("SDL_VIDEO_X11_NODIRECTCOLOR") ) { /* No DirectColor visual? Try again.. */ |
0 | 151 attribs[i-3] = None; |
152 glx_visualinfo = this->gl_data->glXChooseVisual(GFX_Display, | |
153 SDL_Screen, attribs); | |
154 } | |
155 #endif | |
156 if( !glx_visualinfo ) { | |
157 SDL_SetError( "Couldn't find matching GLX visual"); | |
158 return NULL; | |
159 } | |
1315
e94b0d7c33bc
Merged useful fixes from 1.3 branch
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
160 /* |
e94b0d7c33bc
Merged useful fixes from 1.3 branch
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
161 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
|
162 */ |
0 | 163 return glx_visualinfo; |
164 #else | |
165 SDL_SetError("X11 driver not configured with OpenGL"); | |
166 return NULL; | |
167 #endif | |
168 } | |
169 | |
170 int X11_GL_CreateWindow(_THIS, int w, int h) | |
171 { | |
172 int retval; | |
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
|
173 #ifdef HAVE_OPENGL_X11 |
0 | 174 XSetWindowAttributes attributes; |
175 unsigned long mask; | |
176 unsigned long black; | |
177 | |
178 black = (glx_visualinfo->visual == DefaultVisual(SDL_Display, | |
179 SDL_Screen)) | |
180 ? BlackPixel(SDL_Display, SDL_Screen) : 0; | |
181 attributes.background_pixel = black; | |
182 attributes.border_pixel = black; | |
183 attributes.colormap = SDL_XColorMap; | |
184 mask = CWBackPixel | CWBorderPixel | CWColormap; | |
185 | |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
1060
diff
changeset
|
186 SDL_Window = pXCreateWindow(SDL_Display, WMwindow, |
0 | 187 0, 0, w, h, 0, glx_visualinfo->depth, |
188 InputOutput, glx_visualinfo->visual, | |
189 mask, &attributes); | |
190 if ( !SDL_Window ) { | |
191 SDL_SetError("Could not create window"); | |
192 return -1; | |
193 } | |
194 retval = 0; | |
195 #else | |
196 SDL_SetError("X11 driver not configured with OpenGL"); | |
197 retval = -1; | |
198 #endif | |
199 return(retval); | |
200 } | |
201 | |
202 int X11_GL_CreateContext(_THIS) | |
203 { | |
204 int retval; | |
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
|
205 #ifdef HAVE_OPENGL_X11 |
0 | 206 /* We do this to create a clean separation between X and GLX errors. */ |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
1060
diff
changeset
|
207 pXSync( SDL_Display, False ); |
0 | 208 glx_context = this->gl_data->glXCreateContext(GFX_Display, |
209 glx_visualinfo, NULL, True); | |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
1060
diff
changeset
|
210 pXSync( GFX_Display, False ); |
0 | 211 |
212 if (glx_context == NULL) { | |
213 SDL_SetError("Could not create GL context"); | |
214 return -1; | |
215 } | |
216 | |
217 gl_active = 1; | |
218 #else | |
219 SDL_SetError("X11 driver not configured with OpenGL"); | |
220 #endif | |
221 if ( gl_active ) { | |
222 retval = 0; | |
223 } else { | |
224 retval = -1; | |
225 } | |
226 return(retval); | |
227 } | |
228 | |
229 void X11_GL_Shutdown(_THIS) | |
230 { | |
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
|
231 #ifdef HAVE_OPENGL_X11 |
0 | 232 /* Clean up OpenGL */ |
233 if( glx_context ) { | |
234 this->gl_data->glXMakeCurrent(GFX_Display, None, NULL); | |
235 | |
236 if (glx_context != NULL) | |
237 this->gl_data->glXDestroyContext(GFX_Display, glx_context); | |
238 | |
239 glx_context = NULL; | |
240 } | |
241 gl_active = 0; | |
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
|
242 #endif /* HAVE_OPENGL_X11 */ |
0 | 243 } |
244 | |
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
|
245 #ifdef HAVE_OPENGL_X11 |
0 | 246 |
247 /* Make the current context active */ | |
248 int X11_GL_MakeCurrent(_THIS) | |
249 { | |
250 int retval; | |
638
b0108e9dea53
Date: Sun, 11 May 2003 19:59:06 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
566
diff
changeset
|
251 |
0 | 252 retval = 0; |
253 if ( ! this->gl_data->glXMakeCurrent(GFX_Display, | |
254 SDL_Window, glx_context) ) { | |
255 SDL_SetError("Unable to make GL context current"); | |
256 retval = -1; | |
257 } | |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
1060
diff
changeset
|
258 pXSync( GFX_Display, False ); |
0 | 259 |
260 /* More Voodoo X server workarounds... Grr... */ | |
261 SDL_Lock_EventThread(); | |
262 X11_CheckDGAMouse(this); | |
263 SDL_Unlock_EventThread(); | |
264 | |
265 return(retval); | |
266 } | |
267 | |
268 /* Get attribute data from glX. */ | |
269 int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value) | |
270 { | |
271 int retval; | |
272 int glx_attrib = None; | |
273 | |
274 switch( attrib ) { | |
275 case SDL_GL_RED_SIZE: | |
276 glx_attrib = GLX_RED_SIZE; | |
277 break; | |
278 case SDL_GL_GREEN_SIZE: | |
279 glx_attrib = GLX_GREEN_SIZE; | |
280 break; | |
281 case SDL_GL_BLUE_SIZE: | |
282 glx_attrib = GLX_BLUE_SIZE; | |
283 break; | |
284 case SDL_GL_ALPHA_SIZE: | |
285 glx_attrib = GLX_ALPHA_SIZE; | |
286 break; | |
287 case SDL_GL_DOUBLEBUFFER: | |
288 glx_attrib = GLX_DOUBLEBUFFER; | |
289 break; | |
290 case SDL_GL_BUFFER_SIZE: | |
291 glx_attrib = GLX_BUFFER_SIZE; | |
292 break; | |
293 case SDL_GL_DEPTH_SIZE: | |
294 glx_attrib = GLX_DEPTH_SIZE; | |
295 break; | |
296 case SDL_GL_STENCIL_SIZE: | |
297 glx_attrib = GLX_STENCIL_SIZE; | |
298 break; | |
299 case SDL_GL_ACCUM_RED_SIZE: | |
300 glx_attrib = GLX_ACCUM_RED_SIZE; | |
301 break; | |
302 case SDL_GL_ACCUM_GREEN_SIZE: | |
303 glx_attrib = GLX_ACCUM_GREEN_SIZE; | |
304 break; | |
305 case SDL_GL_ACCUM_BLUE_SIZE: | |
306 glx_attrib = GLX_ACCUM_BLUE_SIZE; | |
307 break; | |
308 case SDL_GL_ACCUM_ALPHA_SIZE: | |
309 glx_attrib = GLX_ACCUM_ALPHA_SIZE; | |
310 break; | |
450
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
311 case SDL_GL_STEREO: |
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
312 glx_attrib = GLX_STEREO; |
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
313 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
|
314 case SDL_GL_MULTISAMPLEBUFFERS: |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
646
diff
changeset
|
315 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
|
316 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
|
317 case SDL_GL_MULTISAMPLESAMPLES: |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
646
diff
changeset
|
318 glx_attrib = GLX_SAMPLES_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
646
diff
changeset
|
319 break; |
0 | 320 default: |
321 return(-1); | |
322 } | |
323 | |
324 retval = this->gl_data->glXGetConfig(GFX_Display, glx_visualinfo, glx_attrib, value); | |
325 | |
326 return retval; | |
327 } | |
328 | |
329 void X11_GL_SwapBuffers(_THIS) | |
330 { | |
331 this->gl_data->glXSwapBuffers(GFX_Display, SDL_Window); | |
332 } | |
333 | |
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
|
334 #endif /* HAVE_OPENGL_X11 */ |
0 | 335 |
336 void X11_GL_UnloadLibrary(_THIS) | |
337 { | |
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
|
338 #ifdef HAVE_OPENGL_X11 |
0 | 339 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
|
340 |
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
|
341 /* !!! FIXME: Can we just use SDL_UnloadObject() everywhere? */ |
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
|
342 #ifdef USE_DLOPEN |
0 | 343 dlclose(this->gl_config.dll_handle); |
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
|
344 #else |
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
|
345 SDL_UnloadObject(this->gl_config.dll_handle); |
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
|
346 #endif |
0 | 347 |
348 this->gl_data->glXGetProcAddress = NULL; | |
349 this->gl_data->glXChooseVisual = NULL; | |
350 this->gl_data->glXCreateContext = NULL; | |
351 this->gl_data->glXDestroyContext = NULL; | |
352 this->gl_data->glXMakeCurrent = NULL; | |
353 this->gl_data->glXSwapBuffers = NULL; | |
354 | |
355 this->gl_config.dll_handle = NULL; | |
356 this->gl_config.driver_loaded = 0; | |
357 } | |
358 #endif | |
359 } | |
360 | |
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
|
361 #ifdef HAVE_OPENGL_X11 |
0 | 362 |
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
|
363 static void *do_dlsym(void *handle, const char *name) |
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
|
364 { |
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
|
365 /* !!! FIXME: Can we just use SDL_LoadFunction() everywhere? */ |
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
|
366 #ifdef USE_DLOPEN |
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
|
367 return dlsym(handle, name); |
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
|
368 #else |
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
|
369 return SDL_LoadFunction(handle, name); |
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
|
370 #endif |
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
|
371 } |
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
|
372 |
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
|
373 #if defined(__OpenBSD__) && !defined(__ELF__) |
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
|
374 #define do_dlsym(x,y) do_dlsym(x, "_" y) |
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
|
375 #endif |
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
|
376 |
0 | 377 /* Passing a NULL path means load pointers from the application */ |
378 int X11_GL_LoadLibrary(_THIS, const char* path) | |
379 { | |
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
|
380 void* handle = NULL; |
0 | 381 |
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
|
382 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
|
383 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
|
384 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
|
385 } |
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
|
386 |
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
|
387 if ( path == NULL ) { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1315
diff
changeset
|
388 path = SDL_getenv("SDL_VIDEO_GL_DRIVER"); |
0 | 389 if ( path == NULL ) { |
390 path = DEFAULT_OPENGL; | |
391 } | |
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
|
392 } |
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
|
393 |
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
|
394 /* !!! FIXME: Can we just use SDL_LoadObject() everywhere? */ |
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
|
395 #ifdef USE_DLOPEN |
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
|
396 { |
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
|
397 #ifdef RTLD_GLOBAL |
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
|
398 int dlopen_flags = RTLD_LAZY | RTLD_GLOBAL; |
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
|
399 #else |
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
|
400 int dlopen_flags = RTLD_LAZY; |
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
|
401 #endif |
0 | 402 handle = dlopen(path, dlopen_flags); |
1246
ca51a76a7328
Make error message meaningful if dlopen() fails on libX11.
Ryan C. Gordon <icculus@icculus.org>
parents:
1196
diff
changeset
|
403 if ( handle == NULL ) { |
ca51a76a7328
Make error message meaningful if dlopen() fails on libX11.
Ryan C. Gordon <icculus@icculus.org>
parents:
1196
diff
changeset
|
404 SDL_SetError("Could not load OpenGL library: %s", (const char *) dlerror()); |
ca51a76a7328
Make error message meaningful if dlopen() fails on libX11.
Ryan C. Gordon <icculus@icculus.org>
parents:
1196
diff
changeset
|
405 return -1; |
ca51a76a7328
Make error message meaningful if dlopen() fails on libX11.
Ryan C. Gordon <icculus@icculus.org>
parents:
1196
diff
changeset
|
406 } |
0 | 407 } |
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
|
408 #else |
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
|
409 handle = SDL_LoadObject(path); |
1246
ca51a76a7328
Make error message meaningful if dlopen() fails on libX11.
Ryan C. Gordon <icculus@icculus.org>
parents:
1196
diff
changeset
|
410 if ( handle == NULL ) { |
1247
ff73ee89ff4b
Don't trample SDL_LoadObject()'s error message in GL loader.
Ryan C. Gordon <icculus@icculus.org>
parents:
1246
diff
changeset
|
411 /* SDL_LoadObject() will call SDL_SetError() for us. */ |
1246
ca51a76a7328
Make error message meaningful if dlopen() fails on libX11.
Ryan C. Gordon <icculus@icculus.org>
parents:
1196
diff
changeset
|
412 return -1; |
ca51a76a7328
Make error message meaningful if dlopen() fails on libX11.
Ryan C. Gordon <icculus@icculus.org>
parents:
1196
diff
changeset
|
413 } |
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
|
414 #endif |
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
|
415 |
0 | 416 |
417 /* Unload the old driver and reset the pointers */ | |
418 X11_GL_UnloadLibrary(this); | |
419 | |
420 /* Load new function pointers */ | |
180
578815880307
Do proper typecasting so this compiles on IRIX
Sam Lantinga <slouken@libsdl.org>
parents:
127
diff
changeset
|
421 this->gl_data->glXGetProcAddress = |
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
|
422 (void *(*)(const GLubyte *)) do_dlsym(handle, "glXGetProcAddressARB"); |
180
578815880307
Do proper typecasting so this compiles on IRIX
Sam Lantinga <slouken@libsdl.org>
parents:
127
diff
changeset
|
423 this->gl_data->glXChooseVisual = |
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
|
424 (XVisualInfo *(*)(Display *, int, int *)) do_dlsym(handle, "glXChooseVisual"); |
180
578815880307
Do proper typecasting so this compiles on IRIX
Sam Lantinga <slouken@libsdl.org>
parents:
127
diff
changeset
|
425 this->gl_data->glXCreateContext = |
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
|
426 (GLXContext (*)(Display *, XVisualInfo *, GLXContext, int)) do_dlsym(handle, "glXCreateContext"); |
180
578815880307
Do proper typecasting so this compiles on IRIX
Sam Lantinga <slouken@libsdl.org>
parents:
127
diff
changeset
|
427 this->gl_data->glXDestroyContext = |
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
|
428 (void (*)(Display *, GLXContext)) do_dlsym(handle, "glXDestroyContext"); |
180
578815880307
Do proper typecasting so this compiles on IRIX
Sam Lantinga <slouken@libsdl.org>
parents:
127
diff
changeset
|
429 this->gl_data->glXMakeCurrent = |
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
|
430 (int (*)(Display *, GLXDrawable, GLXContext)) do_dlsym(handle, "glXMakeCurrent"); |
180
578815880307
Do proper typecasting so this compiles on IRIX
Sam Lantinga <slouken@libsdl.org>
parents:
127
diff
changeset
|
431 this->gl_data->glXSwapBuffers = |
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
|
432 (void (*)(Display *, GLXDrawable)) do_dlsym(handle, "glXSwapBuffers"); |
180
578815880307
Do proper typecasting so this compiles on IRIX
Sam Lantinga <slouken@libsdl.org>
parents:
127
diff
changeset
|
433 this->gl_data->glXGetConfig = |
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
|
434 (int (*)(Display *, XVisualInfo *, int, int *)) do_dlsym(handle, "glXGetConfig"); |
638
b0108e9dea53
Date: Sun, 11 May 2003 19:59:06 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
566
diff
changeset
|
435 this->gl_data->glXQueryExtensionsString = |
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
|
436 (const char *(*)(Display *, int)) do_dlsym(handle, "glXQueryExtensionsString"); |
638
b0108e9dea53
Date: Sun, 11 May 2003 19:59:06 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
566
diff
changeset
|
437 |
1315
e94b0d7c33bc
Merged useful fixes from 1.3 branch
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
438 |
0 | 439 if ( (this->gl_data->glXChooseVisual == NULL) || |
440 (this->gl_data->glXCreateContext == NULL) || | |
441 (this->gl_data->glXDestroyContext == NULL) || | |
442 (this->gl_data->glXMakeCurrent == NULL) || | |
443 (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
|
444 (this->gl_data->glXGetConfig == NULL) || |
b0108e9dea53
Date: Sun, 11 May 2003 19:59:06 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
566
diff
changeset
|
445 (this->gl_data->glXQueryExtensionsString == NULL)) { |
0 | 446 SDL_SetError("Could not retrieve OpenGL functions"); |
447 return -1; | |
448 } | |
449 | |
450 this->gl_config.dll_handle = handle; | |
451 this->gl_config.driver_loaded = 1; | |
452 if ( path ) { | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1315
diff
changeset
|
453 SDL_strncpy(this->gl_config.driver_path, path, |
0 | 454 sizeof(this->gl_config.driver_path)-1); |
455 } else { | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1315
diff
changeset
|
456 SDL_strcpy(this->gl_config.driver_path, ""); |
0 | 457 } |
458 return 0; | |
459 } | |
460 | |
461 void *X11_GL_GetProcAddress(_THIS, const char* proc) | |
462 { | |
110
7edee9f0f2cc
SDL GL dynamic loading fix for OpenBSD
Sam Lantinga <slouken@lokigames.com>
parents:
29
diff
changeset
|
463 static char procname[1024]; |
0 | 464 void* handle; |
110
7edee9f0f2cc
SDL GL dynamic loading fix for OpenBSD
Sam Lantinga <slouken@lokigames.com>
parents:
29
diff
changeset
|
465 void* retval; |
0 | 466 |
467 handle = this->gl_config.dll_handle; | |
468 if ( this->gl_data->glXGetProcAddress ) { | |
1196
b81f54c3963f
Fixed compile warnings with gcc 4
Sam Lantinga <slouken@libsdl.org>
parents:
1191
diff
changeset
|
469 return this->gl_data->glXGetProcAddress((const GLubyte *)proc); |
0 | 470 } |
110
7edee9f0f2cc
SDL GL dynamic loading fix for OpenBSD
Sam Lantinga <slouken@lokigames.com>
parents:
29
diff
changeset
|
471 #if defined(__OpenBSD__) && !defined(__ELF__) |
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
|
472 #undef do_dlsym |
110
7edee9f0f2cc
SDL GL dynamic loading fix for OpenBSD
Sam Lantinga <slouken@lokigames.com>
parents:
29
diff
changeset
|
473 #endif |
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
|
474 retval = do_dlsym(handle, proc); |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1315
diff
changeset
|
475 if (!retval && SDL_strlen(proc) <= 1022) { |
127
0bcae11eba14
Oops, that wasn't right...
Sam Lantinga <slouken@libsdl.org>
parents:
110
diff
changeset
|
476 procname[0] = '_'; |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1315
diff
changeset
|
477 SDL_strcpy(procname + 1, proc); |
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 retval = do_dlsym(handle, procname); |
110
7edee9f0f2cc
SDL GL dynamic loading fix for OpenBSD
Sam Lantinga <slouken@lokigames.com>
parents:
29
diff
changeset
|
479 } |
7edee9f0f2cc
SDL GL dynamic loading fix for OpenBSD
Sam Lantinga <slouken@lokigames.com>
parents:
29
diff
changeset
|
480 return retval; |
0 | 481 } |
482 | |
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
|
483 #endif /* HAVE_OPENGL_X11 */ |