diff options
author | Chad Versace <chad.versace@linux.intel.com> | 2012-05-23 22:54:40 -0700 |
---|---|---|
committer | Chad Versace <chad.versace@linux.intel.com> | 2012-05-23 23:04:25 -0700 |
commit | 6ff1ec54271f708c16a28a43a97ca239dc87b2e8 (patch) | |
tree | 025ada07caa74b093e89f9db06c6dd84d02a332d /src | |
parent | bb204bde9e9afb25cd1dc7327f782808da6e2cd2 (diff) |
glut_egl: Remove glut_egl
This patch removes the glut_egl directory. It has been replaced by
glut_waffle.
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/glut_egl/CMakeLists.no_api.txt | 13 | ||||
-rw-r--r-- | src/glut_egl/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/glut_egl/glut_egl.c | 406 | ||||
-rw-r--r-- | src/glut_egl/glut_egl.h | 105 | ||||
-rw-r--r-- | src/glut_egl/glut_egl_x11.c | 245 | ||||
-rw-r--r-- | src/glut_egl/glut_eglint.h | 101 |
7 files changed, 0 insertions, 875 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cc3143a5f..f1ba7c252 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,3 @@ if(USE_WAFFLE) add_subdirectory(glut_waffle) endif(USE_WAFFLE) - -if(OPENGL_egl_LIBRARY) - add_subdirectory(glut_egl) -endif(OPENGL_egl_LIBRARY) diff --git a/src/glut_egl/CMakeLists.no_api.txt b/src/glut_egl/CMakeLists.no_api.txt deleted file mode 100644 index 90773c4ff..000000000 --- a/src/glut_egl/CMakeLists.no_api.txt +++ /dev/null @@ -1,13 +0,0 @@ -include_directories( - ${GLEXT_INCLUDE_DIR} - ${OPENGL_INCLUDE_PATH} - ) - -link_libraries(${OPENGL_egl_LIBRARY}) - -if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - piglit_add_library (glut_egl - glut_egl.c - glut_egl_x11.c - ) -endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") diff --git a/src/glut_egl/CMakeLists.txt b/src/glut_egl/CMakeLists.txt deleted file mode 100644 index 144a306f4..000000000 --- a/src/glut_egl/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -piglit_include_target_api() diff --git a/src/glut_egl/glut_egl.c b/src/glut_egl/glut_egl.c deleted file mode 100644 index 5dd80eb55..000000000 --- a/src/glut_egl/glut_egl.c +++ /dev/null @@ -1,406 +0,0 @@ -/* - * Copyright (C) 2010 LunarG Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Chia-I Wu <olv@lunarg.com> - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdarg.h> -#include <sys/time.h> - -#include <EGL/egl.h> -#include <EGL/eglext.h> - -#include <glut_egl/glut_eglint.h> - -static struct glut_state _glut_state = { - .api_mask = GLUT_OPENGL_ES1_BIT, - .display_mode = GLUT_RGB, - .window_width = 300, - .window_height = 300, - .verbose = 0, - .num_windows = 0, -}; - -struct glut_state *_glut = &_glut_state; - -void -_glutFatal(char *format, ...) -{ - va_list args; - - va_start(args, format); - - fprintf(stderr, "GLUT_EGL: "); - vfprintf(stderr, format, args); - va_end(args); - putc('\n', stderr); - - exit(1); -} - -/* return current time (in milliseconds) */ -int -_glutNow(void) -{ - struct timeval tv; -#ifdef __VMS - (void) gettimeofday(&tv, NULL ); -#else - struct timezone tz; - (void) gettimeofday(&tv, &tz); -#endif - return tv.tv_sec * 1000 + tv.tv_usec / 1000; -} - -static void -_glutDestroyWindow(struct glut_window *win) -{ - if (_glut->surface_type != EGL_PBUFFER_BIT && - _glut->surface_type != EGL_SCREEN_BIT_MESA) - eglDestroySurface(_glut->dpy, win->surface); - - _glutNativeFiniWindow(win); - - eglDestroyContext(_glut->dpy, win->context); -} - -static EGLConfig -_glutChooseConfig(void) -{ - EGLConfig config; - EGLint config_attribs[32]; - EGLint renderable_type, num_configs, i; - - i = 0; - config_attribs[i++] = EGL_RED_SIZE; - config_attribs[i++] = 1; - config_attribs[i++] = EGL_GREEN_SIZE; - config_attribs[i++] = 1; - config_attribs[i++] = EGL_BLUE_SIZE; - config_attribs[i++] = 1; - - config_attribs[i++] = EGL_ALPHA_SIZE; - if (_glut->display_mode & GLUT_ALPHA) - config_attribs[i++] = 1; - else - config_attribs[i++] = 0; - - config_attribs[i++] = EGL_DEPTH_SIZE; - if (_glut->display_mode & GLUT_DEPTH) - config_attribs[i++] = 1; - else - config_attribs[i++] = 0; - - config_attribs[i++] = EGL_STENCIL_SIZE; - if (_glut->display_mode & GLUT_STENCIL) - config_attribs[i++] = 1; - else - config_attribs[i++] = 0; - - config_attribs[i++] = EGL_SURFACE_TYPE; - config_attribs[i++] = _glut->surface_type; - - config_attribs[i++] = EGL_RENDERABLE_TYPE; - renderable_type = 0x0; - if (_glut->api_mask & GLUT_OPENGL_BIT) - renderable_type |= EGL_OPENGL_BIT; - if (_glut->api_mask & GLUT_OPENGL_ES1_BIT) - renderable_type |= EGL_OPENGL_ES_BIT; - if (_glut->api_mask & GLUT_OPENGL_ES2_BIT) - renderable_type |= EGL_OPENGL_ES2_BIT; - if (_glut->api_mask & GLUT_OPENVG_BIT) - renderable_type |= EGL_OPENVG_BIT; - config_attribs[i++] = renderable_type; - - config_attribs[i] = EGL_NONE; - - if (!eglChooseConfig(_glut->dpy, - config_attribs, &config, 1, &num_configs) || !num_configs) - _glutFatal("failed to choose a config"); - - return config; -} - -static struct glut_window * -_glutCreateWindow(const char *title, int x, int y, int w, int h) -{ - struct glut_window *win; - EGLint context_attribs[4]; - EGLint api, i; - - win = calloc(1, sizeof(*win)); - if (!win) - _glutFatal("failed to allocate window"); - - win->config = _glutChooseConfig(); - - i = 0; - context_attribs[i] = EGL_NONE; - - /* multiple APIs? */ - - api = EGL_OPENGL_ES_API; - if (_glut->api_mask & GLUT_OPENGL_BIT) { - api = EGL_OPENGL_API; - } - else if (_glut->api_mask & GLUT_OPENVG_BIT) { - api = EGL_OPENVG_API; - } - else if (_glut->api_mask & GLUT_OPENGL_ES2_BIT) { - context_attribs[i++] = EGL_CONTEXT_CLIENT_VERSION; - context_attribs[i++] = 2; - } - - context_attribs[i] = EGL_NONE; - - eglBindAPI(api); - win->context = eglCreateContext(_glut->dpy, - win->config, EGL_NO_CONTEXT, context_attribs); - if (!win->context) - _glutFatal("failed to create context"); - - _glutNativeInitWindow(win, title, x, y, w, h); - switch (_glut->surface_type) { - case EGL_WINDOW_BIT: - win->surface = eglCreateWindowSurface(_glut->dpy, - win->config, win->native.u.window, NULL); - break; - case EGL_PIXMAP_BIT: - win->surface = eglCreatePixmapSurface(_glut->dpy, - win->config, win->native.u.pixmap, NULL); - break; - case EGL_PBUFFER_BIT: - case EGL_SCREEN_BIT_MESA: - win->surface = win->native.u.surface; - break; - default: - break; - } - if (win->surface == EGL_NO_SURFACE) - _glutFatal("failed to create surface"); - - return win; -} - -void -glutInitAPIMask(int mask) -{ - _glut->api_mask = mask; -} - -void -glutInitDisplayMode(unsigned int mode) -{ - _glut->display_mode = mode; -} - -void -glutInitWindowPosition(int x, int y) -{ -} - -void -glutInitWindowSize(int width, int height) -{ - _glut->window_width = width; - _glut->window_height = height; -} - -void -glutInit(int *argcp, char **argv) -{ - int i; - - for (i = 1; i < *argcp; i++) { - if (strcmp(argv[i], "-display") == 0) - _glut->display_name = argv[++i]; - else if (strcmp(argv[i], "-info") == 0) { - _glut->verbose = 1; - } - } - - _glutNativeInitDisplay(); - _glut->dpy = eglGetDisplay(_glut->native_dpy); - - if (!eglInitialize(_glut->dpy, &_glut->major, &_glut->minor)) - _glutFatal("failed to initialize EGL display"); - - _glut->init_time = _glutNow(); - - printf("EGL_VERSION = %s\n", eglQueryString(_glut->dpy, EGL_VERSION)); - if (_glut->verbose) { - printf("EGL_VENDOR = %s\n", eglQueryString(_glut->dpy, EGL_VENDOR)); - printf("EGL_EXTENSIONS = %s\n", - eglQueryString(_glut->dpy, EGL_EXTENSIONS)); - printf("EGL_CLIENT_APIS = %s\n", - eglQueryString(_glut->dpy, EGL_CLIENT_APIS)); - } -} - -int -glutGet(int state) -{ - int val; - - switch (state) { - case GLUT_ELAPSED_TIME: - val = _glutNow() - _glut->init_time; - break; - default: - val = -1; - break; - } - - return val; -} - -void -glutIdleFunc(GLUT_EGLidleCB func) -{ - _glut->idle_cb = func; -} - -void -glutPostRedisplay(void) -{ - _glut->redisplay = 1; -} - -void -glutMainLoop(void) -{ - struct glut_window *win = _glut->current; - - if (!win) - _glutFatal("no window is created\n"); - - if (win->reshape_cb) - win->reshape_cb(win->native.width, win->native.height); - - _glutNativeEventLoop(); -} - -static void -_glutFini(void) -{ - eglTerminate(_glut->dpy); - _glutNativeFiniDisplay(); -} - -void -glutDestroyWindow(int win) -{ - struct glut_window *window = _glut->current; - - if (window->index != win) - return; - - /* XXX it causes some bug in st/egl KMS backend */ - if ( _glut->surface_type != EGL_SCREEN_BIT_MESA) - eglMakeCurrent(_glut->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - - _glutDestroyWindow(_glut->current); -} - -static void -_glutDefaultKeyboard(unsigned char key, int x, int y) -{ - if (key == 27) { - if (_glut->current) - glutDestroyWindow(_glut->current->index); - _glutFini(); - - exit(0); - } -} - -int -glutCreateWindow(const char *title) -{ - struct glut_window *win; - - win = _glutCreateWindow(title, 0, 0, - _glut->window_width, _glut->window_height); - - win->index = _glut->num_windows++; - win->reshape_cb = NULL; - win->display_cb = NULL; - win->keyboard_cb = _glutDefaultKeyboard; - win->special_cb = NULL; - - if (!eglMakeCurrent(_glut->dpy, win->surface, win->surface, win->context)) - _glutFatal("failed to make window current"); - _glut->current = win; - - return win->index; -} - -int -glutGetWindowWidth(void) -{ - struct glut_window *win = _glut->current; - return win->native.width; -} - -int -glutGetWindowHeight(void) -{ - struct glut_window *win = _glut->current; - return win->native.height; -} - -void -glutDisplayFunc(GLUT_EGLdisplayCB func) -{ - struct glut_window *win = _glut->current; - win->display_cb = func; - -} - -void -glutReshapeFunc(GLUT_EGLreshapeCB func) -{ - struct glut_window *win = _glut->current; - win->reshape_cb = func; -} - -void -glutKeyboardFunc(GLUT_EGLkeyboardCB func) -{ - struct glut_window *win = _glut->current; - win->keyboard_cb = func; -} - -void -glutSpecialFunc(GLUT_EGLspecialCB func) -{ - struct glut_window *win = _glut->current; - win->special_cb = func; -} - -void -glutSwapBuffers(void) -{ -} diff --git a/src/glut_egl/glut_egl.h b/src/glut_egl/glut_egl.h deleted file mode 100644 index 8b51b640a..000000000 --- a/src/glut_egl/glut_egl.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2010 LunarG Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Chia-I Wu <olv@lunarg.com> - */ - -#pragma once - -enum { - GLUT_RGB = 0, - GLUT_RGBA = 0, - GLUT_INDEX = 1, - GLUT_SINGLE = 0, - GLUT_DOUBLE = 2, - GLUT_ACCUM = 4, - GLUT_ALPHA = 8, - GLUT_DEPTH = 16, - GLUT_STENCIL = 32, -}; - -/* used by glutInitAPIMask */ -enum { - GLUT_OPENGL_BIT = 0x1, - GLUT_OPENGL_ES1_BIT = 0x2, - GLUT_OPENGL_ES2_BIT = 0x4, - GLUT_OPENVG_BIT = 0x8 -}; - -/* used by GLUT_EGLspecialCB */ -enum { - /* function keys */ - GLUT_KEY_F1 = 1, - GLUT_KEY_F2 = 2, - GLUT_KEY_F3 = 3, - GLUT_KEY_F4 = 4, - GLUT_KEY_F5 = 5, - GLUT_KEY_F6 = 6, - GLUT_KEY_F7 = 7, - GLUT_KEY_F8 = 8, - GLUT_KEY_F9 = 9, - GLUT_KEY_F10 = 10, - GLUT_KEY_F11 = 11, - GLUT_KEY_F12 = 12, - - /* directional keys */ - GLUT_KEY_LEFT = 100, - GLUT_KEY_UP = 101, - GLUT_KEY_RIGHT = 102, - GLUT_KEY_DOWN = 103, -}; - -/* used by glutGet */ -enum { - GLUT_ELAPSED_TIME -}; - -typedef void (*GLUT_EGLidleCB)(void); -typedef void (*GLUT_EGLreshapeCB)(int, int); -typedef void (*GLUT_EGLdisplayCB)(void); -typedef void (*GLUT_EGLkeyboardCB)(unsigned char, int, int); -typedef void (*GLUT_EGLspecialCB)(int, int, int); - -void glutInitAPIMask(int mask); -void glutInitDisplayMode(unsigned int mode); -void glutInitWindowPosition(int x, int y); -void glutInitWindowSize(int width, int height); -void glutInit(int *argcp, char **argv); - -int glutGet(int state); - -void glutIdleFunc(GLUT_EGLidleCB func); -void glutPostRedisplay(void); - -void glutMainLoop(void); - -int glutCreateWindow(const char *title); -void glutDestroyWindow(int win); - -int glutGetWindowWidth(void); -int glutGetWindowHeight(void); - -void glutDisplayFunc(GLUT_EGLdisplayCB func); -void glutReshapeFunc(GLUT_EGLreshapeCB func); -void glutKeyboardFunc(GLUT_EGLkeyboardCB func); -void glutSpecialFunc(GLUT_EGLspecialCB func); -void glutSwapBuffers(void); diff --git a/src/glut_egl/glut_egl_x11.c b/src/glut_egl/glut_egl_x11.c deleted file mode 100644 index 7a857c8e7..000000000 --- a/src/glut_egl/glut_egl_x11.c +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright (C) 2010 LunarG Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Chia-I Wu <olv@lunarg.com> - */ - -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/keysym.h> - -#include <glut_egl/glut_eglint.h> - -void -_glutNativeInitDisplay(void) -{ - _glut->native_dpy = XOpenDisplay(_glut->display_name); - if (!_glut->native_dpy) - _glutFatal("failed to initialize native display"); - - _glut->surface_type = EGL_WINDOW_BIT; -} - -void -_glutNativeFiniDisplay(void) -{ - XCloseDisplay(_glut->native_dpy); -} - -void -_glutNativeInitWindow(struct glut_window *win, const char *title, - int x, int y, int w, int h) -{ - XVisualInfo *visInfo, visTemplate; - int num_visuals; - Window root, xwin; - XSetWindowAttributes attr; - unsigned long mask; - EGLint vid; - - if (!eglGetConfigAttrib(_glut->dpy, - win->config, EGL_NATIVE_VISUAL_ID, &vid)) - _glutFatal("failed to get visual id"); - - /* The X window visual must match the EGL config */ - visTemplate.visualid = vid; - visInfo = XGetVisualInfo(_glut->native_dpy, - VisualIDMask, &visTemplate, &num_visuals); - if (!visInfo) - _glutFatal("failed to get an visual of id 0x%x", vid); - - root = RootWindow(_glut->native_dpy, DefaultScreen(_glut->native_dpy)); - - /* window attributes */ - attr.background_pixel = 0; - attr.border_pixel = 0; - attr.colormap = XCreateColormap(_glut->native_dpy, - root, visInfo->visual, AllocNone); - attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask; - mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; - - xwin = XCreateWindow(_glut->native_dpy, root, x, y, w, h, - 0, visInfo->depth, InputOutput, visInfo->visual, mask, &attr); - if (!xwin) - _glutFatal("failed to create a window"); - - XFree(visInfo); - - /* set hints and properties */ - { - XSizeHints sizehints; - sizehints.x = x; - sizehints.y = y; - sizehints.width = w; - sizehints.height = h; - sizehints.flags = USSize | USPosition; - XSetNormalHints(_glut->native_dpy, xwin, &sizehints); - XSetStandardProperties(_glut->native_dpy, xwin, - title, title, None, (char **) NULL, 0, &sizehints); - } - - XMapWindow(_glut->native_dpy, xwin); - - win->native.u.window = xwin; - win->native.width = w; - win->native.height = h; -} - -void -_glutNativeFiniWindow(struct glut_window *win) -{ - XDestroyWindow(_glut->native_dpy, win->native.u.window); -} - -static int -lookup_keysym(KeySym sym) -{ - int special; - - switch (sym) { - case XK_F1: - special = GLUT_KEY_F1; - break; - case XK_F2: - special = GLUT_KEY_F2; - break; - case XK_F3: - special = GLUT_KEY_F3; - break; - case XK_F4: - special = GLUT_KEY_F4; - break; - case XK_F5: - special = GLUT_KEY_F5; - break; - case XK_F6: - special = GLUT_KEY_F6; - break; - case XK_F7: - special = GLUT_KEY_F7; - break; - case XK_F8: - special = GLUT_KEY_F8; - break; - case XK_F9: - special = GLUT_KEY_F9; - break; - case XK_F10: - special = GLUT_KEY_F10; - break; - case XK_F11: - special = GLUT_KEY_F11; - break; - case XK_F12: - special = GLUT_KEY_F12; - break; - case XK_KP_Left: - case XK_Left: - special = GLUT_KEY_LEFT; - break; - case XK_KP_Up: - case XK_Up: - special = GLUT_KEY_UP; - break; - case XK_KP_Right: - case XK_Right: - special = GLUT_KEY_RIGHT; - break; - case XK_KP_Down: - case XK_Down: - special = GLUT_KEY_DOWN; - break; - default: - special = -1; - break; - } - - return special; -} - -static void -next_event(struct glut_window *win) -{ - int redraw = 0; - XEvent event; - - if (!XPending(_glut->native_dpy)) { - if (_glut->idle_cb) - _glut->idle_cb(); - return; - } - - XNextEvent(_glut->native_dpy, &event); - - switch (event.type) { - case Expose: - redraw = 1; - break; - case ConfigureNotify: - win->native.width = event.xconfigure.width; - win->native.height = event.xconfigure.height; - if (win->reshape_cb) - win->reshape_cb(win->native.width, win->native.height); - break; - case KeyPress: - { - char buffer[1]; - KeySym sym; - int r; - - r = XLookupString(&event.xkey, - buffer, sizeof(buffer), &sym, NULL); - if (r && win->keyboard_cb) { - win->keyboard_cb(buffer[0], event.xkey.x, event.xkey.y); - } - else if (!r && win->special_cb) { - r = lookup_keysym(sym); - if (r >= 0) - win->special_cb(r, event.xkey.x, event.xkey.y); - } - } - redraw = 1; - break; - default: - ; /*no-op*/ - } - - _glut->redisplay = redraw; -} - -void -_glutNativeEventLoop(void) -{ - while (1) { - struct glut_window *win = _glut->current; - - next_event(win); - - if (_glut->redisplay) { - _glut->redisplay = 0; - - if (win->display_cb) - win->display_cb(); - eglSwapBuffers(_glut->dpy, win->surface); - } - } -} diff --git a/src/glut_egl/glut_eglint.h b/src/glut_egl/glut_eglint.h deleted file mode 100644 index 6287ec7e6..000000000 --- a/src/glut_egl/glut_eglint.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (C) 2010 LunarG Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Chia-I Wu <olv@lunarg.com> - */ - -#pragma once - -#include <EGL/egl.h> -#include <glut_egl/glut_egl.h> - -struct glut_window { - EGLConfig config; - EGLContext context; - - /* initialized by native display */ - struct { - union { - EGLNativeWindowType window; - EGLNativePixmapType pixmap; - EGLSurface surface; /* pbuffer or screen surface */ - } u; - int width, height; - } native; - - EGLSurface surface; - - int index; - - GLUT_EGLreshapeCB reshape_cb; - GLUT_EGLdisplayCB display_cb; - GLUT_EGLkeyboardCB keyboard_cb; - GLUT_EGLspecialCB special_cb; -}; - -struct glut_state { - int api_mask; - int display_mode; - int window_width, window_height; - const char *display_name; - int verbose; - int init_time; - - GLUT_EGLidleCB idle_cb; - - int num_windows; - - /* initialized by native display */ - EGLNativeDisplayType native_dpy; - EGLint surface_type; - - EGLDisplay dpy; - EGLint major, minor; - - struct glut_window *current; - - int redisplay; -}; - -extern struct glut_state *_glut; - -void -_glutFatal(char *format, ...); - -int -_glutNow(void); - -void -_glutNativeInitDisplay(void); - -void -_glutNativeFiniDisplay(void); - -void -_glutNativeInitWindow(struct glut_window *win, const char *title, - int x, int y, int w, int h); - -void -_glutNativeFiniWindow(struct glut_window *win); - -void -_glutNativeEventLoop(void); |