From f51f62e8ed5227f410efa46337a95af25d7eb616 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 6 Apr 2010 13:17:56 +0800 Subject: progs/egl: Port drawtex and torus to eglut. This brings the demos also to KMS and removes about 400 duplicated lines of code. --- progs/egl/eglut/eglut.c | 28 ++++++++++++++++++++++++---- progs/egl/eglut/eglut.h | 1 + 2 files changed, 25 insertions(+), 4 deletions(-) (limited to 'progs/egl/eglut') 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); -- cgit v1.2.3