summaryrefslogtreecommitdiff
path: root/src/glut/glx/glut_glxext.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2001-11-27 02:55:58 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2001-11-27 02:55:58 +0000
commit253270dfcce980c88be6b21204a0c13a0becb2de (patch)
treeda79a43eec35d7f2554e8168afbda04b1834d5ab /src/glut/glx/glut_glxext.c
parent2f3d6203989e3a9843a548796b2c2062f470517e (diff)
use glXGetProcAddressARB to avoid extension linkage problems
Diffstat (limited to 'src/glut/glx/glut_glxext.c')
-rw-r--r--src/glut/glx/glut_glxext.c207
1 files changed, 207 insertions, 0 deletions
diff --git a/src/glut/glx/glut_glxext.c b/src/glut/glx/glut_glxext.c
index 04862432fc..bb2eb475ce 100644
--- a/src/glut/glx/glut_glxext.c
+++ b/src/glut/glx/glut_glxext.c
@@ -46,3 +46,210 @@ __glutIsSupportedByGLX(char *extension)
return 0;
}
#endif
+
+
+
+/*
+ * Wrapping of GLX extension functions.
+ * Technically, we should do a runtime test to see if we've got the
+ * glXGetProcAddressARB() function. I think GLX_ARB_get_proc_address
+ * is pretty widely supported now and any system that has
+ * GLX_ARB_get_proc_address defined in its header files should be OK
+ * at runtime.
+ */
+
+int
+__glut_glXBindChannelToWindowSGIX(Display *dpy, int screen,
+ int channel, Window window)
+{
+#ifdef GLX_ARB_get_proc_address
+ typedef int (*glXBindChannelToWindowSGIX_t) (Display *, int, int, Window);
+ static glXBindChannelToWindowSGIX_t glXBindChannelToWindowSGIX_ptr = NULL;
+ if (!glXBindChannelToWindowSGIX_ptr) {
+ glXBindChannelToWindowSGIX_ptr = (glXBindChannelToWindowSGIX_t)
+ glXGetProcAddressARB((const GLubyte *) "glXBindChannelToWindowSGIX");
+ }
+ if (glXBindChannelToWindowSGIX_ptr)
+ return (*glXBindChannelToWindowSGIX_ptr)(dpy, screen, channel, window);
+ else
+ return 0;
+#elif defined(GLX_SGIX_video_resize)
+ return glXBindChannelToWindowSGIX(dpy, screen, channel, window);
+#else
+ return 0;
+#endif
+}
+
+
+int
+__glut_glXChannelRectSGIX(Display *dpy, int screen, int channel,
+ int x, int y, int w, int h)
+{
+#ifdef GLX_ARB_get_proc_address
+ typedef int (*glXChannelRectSGIX_t)(Display *, int, int, int, int, int, int);
+ static glXChannelRectSGIX_t glXChannelRectSGIX_ptr = NULL;
+ if (!glXChannelRectSGIX_ptr) {
+ glXChannelRectSGIX_ptr = (glXChannelRectSGIX_t)
+ glXGetProcAddressARB((const GLubyte *) "glXChannelRectSGIX");
+ }
+ if (glXChannelRectSGIX_ptr)
+ return (*glXChannelRectSGIX_ptr)(dpy, screen, channel, x, y, w, h);
+ else
+ return 0;
+#elif defined(GLX_SGIX_video_resize)
+ return glXChannelRectSGIX(dpy, screen, channel, x, y, w, h);
+#else
+ return 0;
+#endif
+}
+
+
+int
+__glut_glXQueryChannelRectSGIX(Display *dpy, int screen, int channel,
+ int *x, int *y, int *w, int *h)
+{
+#ifdef GLX_ARB_get_proc_address
+ typedef int (*glXQueryChannelRectSGIX_t)(Display *, int, int,
+ int *, int *, int *, int *);
+ static glXQueryChannelRectSGIX_t glXQueryChannelRectSGIX_ptr = NULL;
+ if (!glXQueryChannelRectSGIX_ptr) {
+ glXQueryChannelRectSGIX_ptr = (glXQueryChannelRectSGIX_t)
+ glXGetProcAddressARB((const GLubyte *) "glXQueryChannelRectSGIX");
+ }
+ if (glXQueryChannelRectSGIX_ptr)
+ return (*glXQueryChannelRectSGIX_ptr)(dpy, screen, channel, x, y, w, h);
+ else
+ return 0;
+#elif defined(GLX_SGIX_video_resize)
+ return glXQueryChannelRectSGIX(dpy, screen, channel, x, y, w, h);
+#else
+ return 0;
+#endif
+}
+
+
+int
+__glut_glXQueryChannelDeltasSGIX(Display *dpy, int screen, int channel,
+ int *dx, int *dy, int *dw, int *dh)
+{
+#ifdef GLX_ARB_get_proc_address
+ typedef int (*glXQueryChannelDeltasSGIX_t)(Display *, int, int,
+ int *, int *, int *, int *);
+ static glXQueryChannelDeltasSGIX_t glXQueryChannelDeltasSGIX_ptr = NULL;
+ if (!glXQueryChannelDeltasSGIX_ptr) {
+ glXQueryChannelDeltasSGIX_ptr = (glXQueryChannelDeltasSGIX_t)
+ glXGetProcAddressARB((const GLubyte *) "glXQueryChannelDeltasSGIX");
+ }
+ if (glXQueryChannelDeltasSGIX_ptr)
+ return (*glXQueryChannelDeltasSGIX_ptr)(dpy, screen, channel,
+ dx, dy, dw, dh);
+ else
+ return 0;
+#elif defined(GLX_SGIX_video_resize)
+ return glXQueryChannelDeltasSGIX(dpy, screen, channel, dx, dy, dw, dh);
+#else
+ return 0;
+#endif
+}
+
+
+int
+__glut_glXChannelRectSyncSGIX(Display *dpy, int screen,
+ int channel, GLenum synctype)
+{
+#ifdef GLX_ARB_get_proc_address
+ typedef int (*glXChannelRectSyncSGIX_t)(Display *, int, int, GLenum);
+ static glXChannelRectSyncSGIX_t glXChannelRectSyncSGIX_ptr = NULL;
+ if (!glXChannelRectSyncSGIX_ptr) {
+ glXChannelRectSyncSGIX_ptr = (glXChannelRectSyncSGIX_t)
+ glXGetProcAddressARB((const GLubyte *) "glXChannelRectSyncSGIX");
+ }
+ if (glXChannelRectSyncSGIX_ptr)
+ return (*glXChannelRectSyncSGIX_ptr)(dpy, screen, channel, synctype);
+ else
+ return 0;
+#elif defined(GLX_SGIX_video_resize)
+ return glXChannelRectSyncSGIX(dpy, screen, channel, synctype);
+#else
+ return 0;
+#endif
+}
+
+
+
+GLXContext
+__glut_glXCreateContextWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config,
+ int render_type, GLXContext share_list,
+ Bool direct)
+{
+#ifdef GLX_ARB_get_proc_address
+ typedef GLXContext (*glXCreateContextWithConfigSGIX_t)(Display *,
+ GLXFBConfigSGIX, int, GLXContext, Bool);
+ static glXCreateContextWithConfigSGIX_t glXCreateContextWithConfig_ptr = NULL;
+ if (!glXCreateContextWithConfig_ptr) {
+ glXCreateContextWithConfig_ptr = (glXCreateContextWithConfigSGIX_t)
+ glXGetProcAddress((const GLubyte *) "glXCreateContextWithConfigSGIX");
+ }
+ if (glXCreateContextWithConfig_ptr)
+ return (*glXCreateContextWithConfig_ptr)(dpy, config, render_type,
+ share_list, direct);
+ else
+ return 0;
+#elif defined(GLX_SGIX_fbconfig)
+ return glXCreateContextWithConfigSGIX(dpy, config, render_type,
+ share_list, direct);
+#else
+ return 0;
+#endif
+}
+
+
+int
+__glut_glXGetFBConfigAttribSGIX(Display *dpy, GLXFBConfigSGIX config,
+ int attribute, int *value)
+{
+#ifdef GLX_ARB_get_proc_address
+ typedef int (*glXGetFBConfigAttribSGIX_t)(Display *,
+ GLXFBConfigSGIX, int, int *);
+ static glXGetFBConfigAttribSGIX_t glXGetFBConfigAttrib_ptr = NULL;
+ if (!glXGetFBConfigAttrib_ptr) {
+ glXGetFBConfigAttrib_ptr = (glXGetFBConfigAttribSGIX_t)
+ glXGetProcAddress((const GLubyte *) "glXGetFBConfigAttribSGIX");
+ }
+ if (glXGetFBConfigAttrib_ptr)
+ return (*glXGetFBConfigAttrib_ptr)(dpy, config, attribute, value);
+ else
+ return 0;
+#elif defined(GLX_SGIX_fbconfig)
+ return glXGetFBConfigAttribSGIX(dpy, config, attribute, value);
+#else
+ return 0;
+#endif
+}
+
+
+GLXFBConfigSGIX
+__glut_glXGetFBConfigFromVisualSGIX(Display *dpy, XVisualInfo *vis)
+{
+#ifdef GLX_ARB_get_proc_address
+ typedef GLXFBConfigSGIX (*glXGetFBConfigFromVisualSGIX_t)(Display *,
+ XVisualInfo *);
+ static glXGetFBConfigFromVisualSGIX_t glXGetFBConfigFromVisual_ptr = NULL;
+ if (!glXGetFBConfigFromVisual_ptr) {
+ glXGetFBConfigFromVisual_ptr = (glXGetFBConfigFromVisualSGIX_t)
+ glXGetProcAddress((const GLubyte *) "glXGetFBConfigFromVisualSGIX");
+ }
+ if (glXGetFBConfigFromVisual_ptr)
+ return (*glXGetFBConfigFromVisual_ptr)(dpy, vis);
+ else
+ return 0;
+#elif defined(GLX_SGIX_fbconfig)
+ return glXGetFBConfigFromVisualSGIX(dpy, vis);
+#else
+ return 0;
+#endif
+}
+
+
+
+