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