From 542717e45b7279e220e033069a6712693eafa49d Mon Sep 17 00:00:00 2001 From: nobled Date: Sun, 30 Jan 2011 22:18:55 +0000 Subject: [PATCH] wayland: fix GLES context creation It was unconditionally binding the desktop-GL API and requesting the wrong API version in the case of GLES1. --- clutter/wayland/clutter-backend-wayland.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/clutter/wayland/clutter-backend-wayland.c b/clutter/wayland/clutter-backend-wayland.c index 2ad0fbdfe..1ba958a61 100644 --- a/clutter/wayland/clutter-backend-wayland.c +++ b/clutter/wayland/clutter-backend-wayland.c @@ -275,6 +275,12 @@ clutter_backend_wayland_post_parse (ClutterBackend *backend, return TRUE; } +#if defined(HAVE_COGL_GLES2) +#define _COGL_GLES_VERSION 2 +#elif defined(HAVE_COGL_GLES) +#define _COGL_GLES_VERSION 1 +#endif + static gboolean try_create_context (ClutterBackend *backend, int retry_cookie, @@ -283,16 +289,19 @@ try_create_context (ClutterBackend *backend, { ClutterBackendWayland *backend_wayland = CLUTTER_BACKEND_WAYLAND (backend); const char *error_message; - +#if defined(HAVE_COGL_GL) eglBindAPI (EGL_OPENGL_API); +#else + eglBindAPI (EGL_OPENGL_ES_API); +#endif if (backend_wayland->egl_context == EGL_NO_CONTEXT) { -#if defined (HAVE_COGL_GLES2) - static const EGLint attribs[] = - { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; -#else +#if defined(HAVE_COGL_GL) static const EGLint *attribs = NULL; +#else + static const EGLint attribs[] = + { EGL_CONTEXT_CLIENT_VERSION, _COGL_GLES_VERSION, EGL_NONE }; #endif backend_wayland->egl_context =