wayland: fix GLES context creation

It was unconditionally binding the desktop-GL API and
requesting the wrong API version in the case of GLES1.
This commit is contained in:
nobled 2011-01-30 22:18:55 +00:00
parent 9dcb9453ed
commit 542717e45b

View File

@ -275,6 +275,12 @@ clutter_backend_wayland_post_parse (ClutterBackend *backend,
return TRUE; 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 static gboolean
try_create_context (ClutterBackend *backend, try_create_context (ClutterBackend *backend,
int retry_cookie, int retry_cookie,
@ -283,16 +289,19 @@ try_create_context (ClutterBackend *backend,
{ {
ClutterBackendWayland *backend_wayland = CLUTTER_BACKEND_WAYLAND (backend); ClutterBackendWayland *backend_wayland = CLUTTER_BACKEND_WAYLAND (backend);
const char *error_message; const char *error_message;
#if defined(HAVE_COGL_GL)
eglBindAPI (EGL_OPENGL_API); eglBindAPI (EGL_OPENGL_API);
#else
eglBindAPI (EGL_OPENGL_ES_API);
#endif
if (backend_wayland->egl_context == EGL_NO_CONTEXT) if (backend_wayland->egl_context == EGL_NO_CONTEXT)
{ {
#if defined (HAVE_COGL_GLES2) #if defined(HAVE_COGL_GL)
static const EGLint attribs[] =
{ EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
#else
static const EGLint *attribs = NULL; static const EGLint *attribs = NULL;
#else
static const EGLint attribs[] =
{ EGL_CONTEXT_CLIENT_VERSION, _COGL_GLES_VERSION, EGL_NONE };
#endif #endif
backend_wayland->egl_context = backend_wayland->egl_context =