diff options
| author | Eric Anholt <eric@anholt.net> | 2007-06-21 14:14:24 -0700 |
|---|---|---|
| committer | Eric Anholt <eric@anholt.net> | 2007-06-21 14:14:24 -0700 |
| commit | 4fe48b4e8568896cdbc822323aeec0a41c72ff2a (patch) | |
| tree | a32edaa514931bad2364b3877302eeaa3847131e /progs/xdemos/texture_from_pixmap.c | |
| parent | 5d9dc02cbecd94f822f853fd01878784596f4eba (diff) | |
| parent | ed5ed6fe2f64f45eb3a43f9c57037d9e9b7fa5ea (diff) | |
Merge branch 'origin' into i915-unification
Diffstat (limited to 'progs/xdemos/texture_from_pixmap.c')
| -rw-r--r-- | progs/xdemos/texture_from_pixmap.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/progs/xdemos/texture_from_pixmap.c b/progs/xdemos/texture_from_pixmap.c index 50870c4df4..ab215b0ac3 100644 --- a/progs/xdemos/texture_from_pixmap.c +++ b/progs/xdemos/texture_from_pixmap.c @@ -43,6 +43,9 @@ static float top, bottom; +static PFNGLXBINDTEXIMAGEEXTPROC glXBindTexImageEXT_func = NULL; +static PFNGLXRELEASETEXIMAGEEXTPROC glXReleaseTexImageEXT_func = NULL; + static Display * OpenDisplay(void) @@ -60,10 +63,20 @@ OpenDisplay(void) screen = DefaultScreen(dpy); ext = glXQueryExtensionsString(dpy, screen); if (!strstr(ext, "GLX_EXT_texture_from_pixmap")) { - printf("GLX_EXT_texture_from_pixmap not supported by GLX\n"); + fprintf(stderr, "GLX_EXT_texture_from_pixmap not supported.\n"); exit(1); } + glXBindTexImageEXT_func = (PFNGLXBINDTEXIMAGEEXTPROC) + glXGetProcAddress((GLubyte *) "glXBindTexImageEXT"); + glXReleaseTexImageEXT_func = (PFNGLXRELEASETEXIMAGEEXTPROC) + glXGetProcAddress((GLubyte*) "glXReleaseTexImageEXT"); + + if (!glXBindTexImageEXT_func || !glXReleaseTexImageEXT_func) { + fprintf(stderr, "glXGetProcAddress failed!\n"); + exit(1); + } + return dpy; } @@ -241,14 +254,14 @@ BindPixmapTexture(Display *dpy, GLXPixmap gp) glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); - glXBindTexImageEXT(dpy, gp, GLX_FRONT_LEFT_EXT, NULL); + glXBindTexImageEXT_func(dpy, gp, GLX_FRONT_LEFT_EXT, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glEnable(GL_TEXTURE_2D); /* - glXReleaseTexImageEXT (display, glxpixmap, GLX_FRONT_LEFT_EXT); + glXReleaseTexImageEXT_func(display, glxpixmap, GLX_FRONT_LEFT_EXT); */ } |
