Chia-I Wu | fe33b70 | 2010-01-23 00:11:48 +0800 | [diff] [blame^] | 1 | #ifndef _SEGL_H_ |
| 2 | #define _SEGL_H_ |
| 3 | |
| 4 | #include <stdarg.h> |
| 5 | #include <EGL/egl.h> |
| 6 | |
| 7 | struct segl_winsys { |
| 8 | EGLNativeDisplayType dpy; |
| 9 | |
| 10 | EGLNativeWindowType (*create_window)(struct segl_winsys *winsys, |
| 11 | const char *name, |
| 12 | EGLint width, EGLint height, |
| 13 | EGLint visual); |
| 14 | void (*destroy_window)(struct segl_winsys *winsys, EGLNativeWindowType win); |
| 15 | |
| 16 | EGLNativePixmapType (*create_pixmap)(struct segl_winsys *winsys, |
| 17 | EGLint width, EGLint height, |
| 18 | EGLint depth); |
| 19 | void (*destroy_pixmap)(struct segl_winsys *winsys, EGLNativePixmapType pix); |
| 20 | |
| 21 | /* get current time in seconds */ |
| 22 | double (*now)(struct segl_winsys *winsys); |
| 23 | /* log a message. OPTIONAL */ |
| 24 | void (*vlog)(struct segl_winsys *winsys, const char *format, va_list ap); |
| 25 | }; |
| 26 | |
| 27 | struct segl { |
| 28 | EGLBoolean verbose; |
| 29 | |
| 30 | struct segl_winsys *winsys; |
| 31 | |
| 32 | EGLint major, minor; |
| 33 | EGLDisplay dpy; |
| 34 | EGLConfig conf; |
| 35 | }; |
| 36 | |
| 37 | struct segl_winsys * |
| 38 | segl_get_winsys(EGLNativeDisplayType dpy); |
| 39 | |
| 40 | struct segl * |
| 41 | segl_new(struct segl_winsys *winsys, const EGLint *attribs); |
| 42 | |
| 43 | void |
| 44 | segl_destroy(struct segl *segl); |
| 45 | |
| 46 | EGLBoolean |
| 47 | segl_create_window(struct segl *segl, const char *name, |
| 48 | EGLint width, EGLint height, const EGLint *attribs, |
| 49 | EGLNativeWindowType *win_ret, EGLSurface *surf_ret); |
| 50 | |
| 51 | EGLBoolean |
| 52 | segl_create_pixmap(struct segl *segl, |
| 53 | EGLint width, EGLint height, const EGLint *attribs, |
| 54 | EGLNativePixmapType *pix_ret, EGLSurface *surf_ret); |
| 55 | |
| 56 | void |
| 57 | segl_benchmark(struct segl *segl, double seconds, |
| 58 | void (*draw_frame)(void *), void *draw_data); |
| 59 | |
| 60 | #endif /* _SEGL_H_ */ |