summaryrefslogtreecommitdiffstats
path: root/progs/egl/eglut
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2010-04-06 13:17:56 +0800
committerChia-I Wu <[email protected]>2010-04-06 13:48:59 +0800
commitf51f62e8ed5227f410efa46337a95af25d7eb616 (patch)
treedfe5ea9ca093fb645e80adf332ea198d3db7c6fc /progs/egl/eglut
parent7d2db19fe581ede34dd1f396f1e0bd46ea5c3776 (diff)
progs/egl: Port drawtex and torus to eglut.
This brings the demos also to KMS and removes about 400 duplicated lines of code.
Diffstat (limited to 'progs/egl/eglut')
-rw-r--r--progs/egl/eglut/eglut.c28
-rw-r--r--progs/egl/eglut/eglut.h1
2 files changed, 25 insertions, 4 deletions
diff --git a/progs/egl/eglut/eglut.c b/progs/egl/eglut/eglut.c
index 0bfd5d5b067..b9b5e6e5a8c 100644
--- a/progs/egl/eglut/eglut.c
+++ b/progs/egl/eglut/eglut.c
@@ -195,6 +195,13 @@ eglutInit(int argc, char **argv)
_eglut->init_time = _eglutNow();
printf("EGL_VERSION = %s\n", eglQueryString(_eglut->dpy, EGL_VERSION));
+ if (_eglut->verbose) {
+ printf("EGL_VENDOR = %s\n", eglQueryString(_eglut->dpy, EGL_VENDOR));
+ printf("EGL_EXTENSIONS = %s\n",
+ eglQueryString(_eglut->dpy, EGL_EXTENSIONS));
+ printf("EGL_CLIENT_APIS = %s\n",
+ eglQueryString(_eglut->dpy, EGL_CLIENT_APIS));
+ }
}
int
@@ -247,14 +254,27 @@ _eglutFini(void)
_eglutNativeFiniDisplay();
}
+void
+eglutDestroyWindow(int win)
+{
+ struct eglut_window *window = _eglut->current;
+
+ if (window->index != win)
+ return;
+
+ /* XXX it causes some bug in st/egl KMS backend */
+ if ( _eglut->surface_type != EGL_SCREEN_BIT_MESA)
+ eglMakeCurrent(_eglut->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+
+ _eglutDestroyWindow(_eglut->current);
+}
+
static void
_eglutDefaultKeyboard(unsigned char key)
{
if (key == 27) {
- /* XXX it causes some bug in st/egl KMS backend */
- if ( _eglut->surface_type != EGL_SCREEN_BIT_MESA)
- eglMakeCurrent(_eglut->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
- _eglutDestroyWindow(_eglut->current);
+ if (_eglut->current)
+ eglutDestroyWindow(_eglut->current->index);
_eglutFini();
exit(0);
diff --git a/progs/egl/eglut/eglut.h b/progs/egl/eglut/eglut.h
index 521cc12eab0..07df4ba9f75 100644
--- a/progs/egl/eglut/eglut.h
+++ b/progs/egl/eglut/eglut.h
@@ -55,6 +55,7 @@ void eglutPostRedisplay(void);
void eglutMainLoop(void);
int eglutCreateWindow(const char *title);
+void eglutDestroyWindow(int win);
int eglutGetWindowWidth(void);
int eglutGetWindowHeight(void);