blob: 20faf6ef027bb5210eb878638de993bb26402041 [file] [log] [blame]
Chia-I Wufe33b702010-01-23 00:11:48 +08001#ifndef _SEGL_H_
2#define _SEGL_H_
3
4#include <stdarg.h>
5#include <EGL/egl.h>
6
7struct 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
27struct segl {
28 EGLBoolean verbose;
29
30 struct segl_winsys *winsys;
31
32 EGLint major, minor;
33 EGLDisplay dpy;
34 EGLConfig conf;
35};
36
37struct segl_winsys *
38segl_get_winsys(EGLNativeDisplayType dpy);
39
40struct segl *
41segl_new(struct segl_winsys *winsys, const EGLint *attribs);
42
43void
44segl_destroy(struct segl *segl);
45
46EGLBoolean
47segl_create_window(struct segl *segl, const char *name,
48 EGLint width, EGLint height, const EGLint *attribs,
49 EGLNativeWindowType *win_ret, EGLSurface *surf_ret);
50
51EGLBoolean
52segl_create_pixmap(struct segl *segl,
53 EGLint width, EGLint height, const EGLint *attribs,
54 EGLNativePixmapType *pix_ret, EGLSurface *surf_ret);
55
56void
57segl_benchmark(struct segl *segl, double seconds,
58 void (*draw_frame)(void *), void *draw_data);
59
60#endif /* _SEGL_H_ */