diff options
Diffstat (limited to 'clients/gles2-helper.h')
-rw-r--r-- | clients/gles2-helper.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/clients/gles2-helper.h b/clients/gles2-helper.h new file mode 100644 index 00000000..12c732a5 --- /dev/null +++ b/clients/gles2-helper.h @@ -0,0 +1,66 @@ +/* + * Copyright © 2013 Intel Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef _GLES2_HELPER_H_ +#define _GLES2_HELPER_H_ + +#include <wayland-client.h> +#include <wayland-egl.h> + +struct program { + GLuint vert, frag, program; + GLuint rotation; + GLuint texture; +}; + +struct gles2_context { + EGLDisplay egl_display; + EGLContext egl_context; + EGLConfig egl_config; + EGLSurface egl_surface; + struct wl_egl_window *native; + struct program *color_program; + struct program *texture_program; + GLuint texture; + int width, height; +}; + +struct gles2_context * +gles2_context_create(struct wl_display *display, + EGLDisplay egl_display, EGLConfig egl_config); +void +gles2_context_destroy(struct gles2_context *ctx); +void +gles2_context_set_surface(struct gles2_context *ctx, + struct wl_surface *surface, int width, int height); +void +gles2_context_clear(struct gles2_context *ctx); +void +gles2_context_set_size(struct gles2_context *ctx, int width, int height); +void +gles2_context_render_triangle(struct gles2_context *ctx, uint32_t time); +void +gles2_context_render_quad(struct gles2_context *ctx, GLuint texture); +void +gles2_context_swap(struct gles2_context *ctx); + +#endif |