2 /* Copyright (c) Mark J. Kilgard, 1997. */
4 /* This program is freely distributable without licensing fees
5 and is provided without guarantee or warrantee expressed or
6 implied. This program is -not- in the public domain. */
12 #if defined(GLX_VERSION_1_1)
14 __glutIsSupportedByGLX(char *extension
)
16 static const char *extensions
= NULL
;
18 char *where
, *terminator
;
21 glXQueryVersion(__glutDisplay
, &major
, &minor
);
22 /* Be careful not to call glXQueryExtensionsString if it
23 looks like the server doesn't support GLX 1.1.
24 Unfortunately, the original GLX 1.0 didn't have the notion
26 if ((major
== 1 && minor
>= 1) || (major
> 1)) {
28 extensions
= glXQueryExtensionsString(__glutDisplay
, __glutScreen
);
29 /* It takes a bit of care to be fool-proof about parsing
30 the GLX extensions string. Don't be fooled by
34 where
= strstr(start
, extension
);
37 terminator
= where
+ strlen(extension
);
38 if (where
== start
|| *(where
- 1) == ' ') {
39 if (*terminator
== ' ' || *terminator
== '\0') {
53 * Wrapping of GLX extension functions.
54 * Technically, we should do a runtime test to see if we've got the
55 * glXGetProcAddressARB() function. I think GLX_ARB_get_proc_address
56 * is pretty widely supported now and any system that has
57 * GLX_ARB_get_proc_address defined in its header files should be OK
62 __glut_glXBindChannelToWindowSGIX(Display
*dpy
, int screen
,
63 int channel
, Window window
)
65 #ifdef GLX_ARB_get_proc_address
66 typedef int (*glXBindChannelToWindowSGIX_t
) (Display
*, int, int, Window
);
67 static glXBindChannelToWindowSGIX_t glXBindChannelToWindowSGIX_ptr
= NULL
;
68 if (!glXBindChannelToWindowSGIX_ptr
) {
69 glXBindChannelToWindowSGIX_ptr
= (glXBindChannelToWindowSGIX_t
)
70 glXGetProcAddressARB((const GLubyte
*) "glXBindChannelToWindowSGIX");
72 if (glXBindChannelToWindowSGIX_ptr
)
73 return (*glXBindChannelToWindowSGIX_ptr
)(dpy
, screen
, channel
, window
);
76 #elif defined(GLX_SGIX_video_resize)
77 return glXBindChannelToWindowSGIX(dpy
, screen
, channel
, window
);
85 __glut_glXChannelRectSGIX(Display
*dpy
, int screen
, int channel
,
86 int x
, int y
, int w
, int h
)
88 #ifdef GLX_ARB_get_proc_address
89 typedef int (*glXChannelRectSGIX_t
)(Display
*, int, int, int, int, int, int);
90 static glXChannelRectSGIX_t glXChannelRectSGIX_ptr
= NULL
;
91 if (!glXChannelRectSGIX_ptr
) {
92 glXChannelRectSGIX_ptr
= (glXChannelRectSGIX_t
)
93 glXGetProcAddressARB((const GLubyte
*) "glXChannelRectSGIX");
95 if (glXChannelRectSGIX_ptr
)
96 return (*glXChannelRectSGIX_ptr
)(dpy
, screen
, channel
, x
, y
, w
, h
);
99 #elif defined(GLX_SGIX_video_resize)
100 return glXChannelRectSGIX(dpy
, screen
, channel
, x
, y
, w
, h
);
108 __glut_glXQueryChannelRectSGIX(Display
*dpy
, int screen
, int channel
,
109 int *x
, int *y
, int *w
, int *h
)
111 #ifdef GLX_ARB_get_proc_address
112 typedef int (*glXQueryChannelRectSGIX_t
)(Display
*, int, int,
113 int *, int *, int *, int *);
114 static glXQueryChannelRectSGIX_t glXQueryChannelRectSGIX_ptr
= NULL
;
115 if (!glXQueryChannelRectSGIX_ptr
) {
116 glXQueryChannelRectSGIX_ptr
= (glXQueryChannelRectSGIX_t
)
117 glXGetProcAddressARB((const GLubyte
*) "glXQueryChannelRectSGIX");
119 if (glXQueryChannelRectSGIX_ptr
)
120 return (*glXQueryChannelRectSGIX_ptr
)(dpy
, screen
, channel
, x
, y
, w
, h
);
123 #elif defined(GLX_SGIX_video_resize)
124 return glXQueryChannelRectSGIX(dpy
, screen
, channel
, x
, y
, w
, h
);
132 __glut_glXQueryChannelDeltasSGIX(Display
*dpy
, int screen
, int channel
,
133 int *dx
, int *dy
, int *dw
, int *dh
)
135 #ifdef GLX_ARB_get_proc_address
136 typedef int (*glXQueryChannelDeltasSGIX_t
)(Display
*, int, int,
137 int *, int *, int *, int *);
138 static glXQueryChannelDeltasSGIX_t glXQueryChannelDeltasSGIX_ptr
= NULL
;
139 if (!glXQueryChannelDeltasSGIX_ptr
) {
140 glXQueryChannelDeltasSGIX_ptr
= (glXQueryChannelDeltasSGIX_t
)
141 glXGetProcAddressARB((const GLubyte
*) "glXQueryChannelDeltasSGIX");
143 if (glXQueryChannelDeltasSGIX_ptr
)
144 return (*glXQueryChannelDeltasSGIX_ptr
)(dpy
, screen
, channel
,
148 #elif defined(GLX_SGIX_video_resize)
149 return glXQueryChannelDeltasSGIX(dpy
, screen
, channel
, dx
, dy
, dw
, dh
);
157 __glut_glXChannelRectSyncSGIX(Display
*dpy
, int screen
,
158 int channel
, GLenum synctype
)
160 #ifdef GLX_ARB_get_proc_address
161 typedef int (*glXChannelRectSyncSGIX_t
)(Display
*, int, int, GLenum
);
162 static glXChannelRectSyncSGIX_t glXChannelRectSyncSGIX_ptr
= NULL
;
163 if (!glXChannelRectSyncSGIX_ptr
) {
164 glXChannelRectSyncSGIX_ptr
= (glXChannelRectSyncSGIX_t
)
165 glXGetProcAddressARB((const GLubyte
*) "glXChannelRectSyncSGIX");
167 if (glXChannelRectSyncSGIX_ptr
)
168 return (*glXChannelRectSyncSGIX_ptr
)(dpy
, screen
, channel
, synctype
);
171 #elif defined(GLX_SGIX_video_resize)
172 return glXChannelRectSyncSGIX(dpy
, screen
, channel
, synctype
);
181 __glut_glXCreateContextWithConfigSGIX(Display
*dpy
, GLXFBConfigSGIX config
,
182 int render_type
, GLXContext share_list
,
185 #ifdef GLX_ARB_get_proc_address
186 typedef GLXContext (*glXCreateContextWithConfigSGIX_t
)(Display
*,
187 GLXFBConfigSGIX
, int, GLXContext
, Bool
);
188 static glXCreateContextWithConfigSGIX_t glXCreateContextWithConfig_ptr
= NULL
;
189 if (!glXCreateContextWithConfig_ptr
) {
190 glXCreateContextWithConfig_ptr
= (glXCreateContextWithConfigSGIX_t
)
191 glXGetProcAddressARB((const GLubyte
*) "glXCreateContextWithConfigSGIX");
193 if (glXCreateContextWithConfig_ptr
)
194 return (*glXCreateContextWithConfig_ptr
)(dpy
, config
, render_type
,
198 #elif defined(GLX_SGIX_fbconfig)
199 return glXCreateContextWithConfigSGIX(dpy
, config
, render_type
,
208 __glut_glXGetFBConfigAttribSGIX(Display
*dpy
, GLXFBConfigSGIX config
,
209 int attribute
, int *value
)
211 #ifdef GLX_ARB_get_proc_address
212 typedef int (*glXGetFBConfigAttribSGIX_t
)(Display
*,
213 GLXFBConfigSGIX
, int, int *);
214 static glXGetFBConfigAttribSGIX_t glXGetFBConfigAttrib_ptr
= NULL
;
215 if (!glXGetFBConfigAttrib_ptr
) {
216 glXGetFBConfigAttrib_ptr
= (glXGetFBConfigAttribSGIX_t
)
217 glXGetProcAddressARB((const GLubyte
*) "glXGetFBConfigAttribSGIX");
219 if (glXGetFBConfigAttrib_ptr
)
220 return (*glXGetFBConfigAttrib_ptr
)(dpy
, config
, attribute
, value
);
223 #elif defined(GLX_SGIX_fbconfig)
224 return glXGetFBConfigAttribSGIX(dpy
, config
, attribute
, value
);
232 __glut_glXGetFBConfigFromVisualSGIX(Display
*dpy
, XVisualInfo
*vis
)
234 #ifdef GLX_ARB_get_proc_address
235 typedef GLXFBConfigSGIX (*glXGetFBConfigFromVisualSGIX_t
)(Display
*,
237 static glXGetFBConfigFromVisualSGIX_t glXGetFBConfigFromVisual_ptr
= NULL
;
238 if (!glXGetFBConfigFromVisual_ptr
) {
239 glXGetFBConfigFromVisual_ptr
= (glXGetFBConfigFromVisualSGIX_t
)
240 glXGetProcAddressARB((const GLubyte
*) "glXGetFBConfigFromVisualSGIX");
242 if (glXGetFBConfigFromVisual_ptr
)
243 return (*glXGetFBConfigFromVisual_ptr
)(dpy
, vis
);
246 #elif defined(GLX_SGIX_fbconfig)
247 return glXGetFBConfigFromVisualSGIX(dpy
, vis
);