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