diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2011-02-09 10:57:44 -0500 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2011-02-09 10:57:44 -0500 |
commit | 0d5007a76fadc5fe99f00fdaf26c3d6ef7fc12a1 (patch) | |
tree | 7b268f2bcbb8cfdb4dbb42b6c47de2e06add1db7 | |
parent | 297d6dd4423611722d119d9e81970d2e8a600fd0 (diff) |
window.c: Use eglGetProcAddress to look up extension functions
-rw-r--r-- | clients/window.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/clients/window.c b/clients/window.c index f495476..c8836a8 100644 --- a/clients/window.c +++ b/clients/window.c @@ -38,8 +38,6 @@ #include <wayland-egl.h> -#define EGL_EGLEXT_PROTOTYPES 1 -#define GL_GLEXT_PROTOTYPES 1 #include <GL/gl.h> #include <EGL/egl.h> #include <EGL/eglext.h> @@ -81,6 +79,10 @@ struct display { cairo_surface_t **pointer_surfaces; display_global_handler_t global_handler; + + PFNGLEGLIMAGETARGETTEXTURE2DOESPROC image_target_texture_2d; + PFNEGLCREATEIMAGEKHRPROC create_image; + PFNEGLDESTROYIMAGEKHRPROC destroy_image; }; struct window { @@ -204,7 +206,7 @@ egl_image_surface_data_destroy(void *p) glDeleteTextures(1, &data->texture); cairo_device_release(d->device); - eglDestroyImageKHR(d->dpy, data->image); + d->destroy_image(d->dpy, data->image); wl_buffer_destroy(data->data.buffer); wl_egl_pixmap_destroy(data->pixmap); free(p); @@ -246,9 +248,10 @@ display_create_egl_image_surface(struct display *display, return NULL; } - data->image = eglCreateImageKHR(dpy, NULL, - EGL_NATIVE_PIXMAP_KHR, - (EGLClientBuffer) data->pixmap, NULL); + data->image = display->create_image(dpy, NULL, + EGL_NATIVE_PIXMAP_KHR, + (EGLClientBuffer) data->pixmap, + NULL); if (data->image == EGL_NO_IMAGE_KHR) { wl_egl_pixmap_destroy(data->pixmap); free(data); @@ -261,7 +264,7 @@ display_create_egl_image_surface(struct display *display, cairo_device_acquire(display->device); glGenTextures(1, &data->texture); glBindTexture(GL_TEXTURE_2D, data->texture); - glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, data->image); + display->image_target_texture_2d(GL_TEXTURE_2D, data->image); cairo_device_release(display->device); surface = cairo_gl_surface_create_for_texture(display->device, @@ -1680,6 +1683,11 @@ display_create(int *argc, char **argv[], const GOptionEntry *option_entries) if (init_egl(d) < 0) return NULL; + d->image_target_texture_2d = + (void *) eglGetProcAddress("glEGLImageTargetTexture2DOES"); + d->create_image = (void *) eglGetProcAddress("eglCreateImageKHR"); + d->destroy_image = (void *) eglGetProcAddress("eglDestroyImageKHR"); + create_pointer_surfaces(d); display_render_frame(d); |