summaryrefslogtreecommitdiff
path: root/boilerplate
diff options
context:
space:
mode:
authorAlexandros Frantzis <alexandros.frantzis@linaro.org>2011-03-04 18:09:44 +0200
committerChris Wilson <chris@chris-wilson.co.uk>2011-05-10 08:35:47 +0100
commit1595f20bb70ebba8d192500d4de455170c8d81a0 (patch)
tree57aa65b3afe2fcdfb78e19fd0d31c767c2224a75 /boilerplate
parent2472ed899cc8bfd97b3cec1f322b601038d28731 (diff)
boilerplate/egl: Add GLES2 support
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'boilerplate')
-rw-r--r--boilerplate/cairo-boilerplate-egl.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/boilerplate/cairo-boilerplate-egl.c b/boilerplate/cairo-boilerplate-egl.c
index 1a5abec6..6ecb8a8b 100644
--- a/boilerplate/cairo-boilerplate-egl.c
+++ b/boilerplate/cairo-boilerplate-egl.c
@@ -33,6 +33,11 @@
#include "cairo-boilerplate-private.h"
#include <cairo-gl.h>
+#if CAIRO_HAS_GL_SURFACE
+#include <GL/gl.h>
+#elif CAIRO_HAS_GLESV2_SURFACE
+#include <GLES2/gl2.h>
+#endif
static const cairo_user_data_key_t gl_closure_key;
@@ -81,7 +86,17 @@ _cairo_boilerplate_egl_create_surface (const char *name,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
+#if CAIRO_HAS_GL_SURFACE
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
+#elif CAIRO_HAS_GLESV2_SURFACE
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
+#endif
+ EGL_NONE
+ };
+ const EGLint ctx_attribs[] = {
+#if CAIRO_HAS_GLESV2_SURFACE
+ EGL_CONTEXT_CLIENT_VERSION, 2,
+#endif
EGL_NONE
};
@@ -101,9 +116,14 @@ _cairo_boilerplate_egl_create_surface (const char *name,
return NULL;
}
+#if CAIRO_HAS_GL_SURFACE
eglBindAPI (EGL_OPENGL_API);
+#elif CAIRO_HAS_GLESV2_SURFACE
+ eglBindAPI (EGL_OPENGL_ES_API);
+#endif
- gltc->ctx = eglCreateContext (gltc->dpy, config, EGL_NO_CONTEXT, NULL);
+ gltc->ctx = eglCreateContext (gltc->dpy, config, EGL_NO_CONTEXT,
+ ctx_attribs);
if (gltc->ctx == EGL_NO_CONTEXT) {
eglTerminate (gltc->dpy);
free (gltc);