annotate src/video/x11/SDL_x11opengles.h @ 4565:e2d46c5c7483

Fixed key repeat detection on X11, and simplified the code for everyone else.
author Sam Lantinga <slouken@libsdl.org>
date Wed, 21 Jul 2010 21:47:12 -0700
parents f7b03b6838cb
children b530ef003506
rev   line source
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
3697
f7b03b6838cb Fixed bug #926
Sam Lantinga <slouken@libsdl.org>
parents: 3190
diff changeset
3 Copyright (C) 1997-2010 Sam Lantinga
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
3697
f7b03b6838cb Fixed bug #926
Sam Lantinga <slouken@libsdl.org>
parents: 3190
diff changeset
6 modify it under the terms of the GNU Lesser General Public
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
3697
f7b03b6838cb Fixed bug #926
Sam Lantinga <slouken@libsdl.org>
parents: 3190
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3697
f7b03b6838cb Fixed bug #926
Sam Lantinga <slouken@libsdl.org>
parents: 3190
diff changeset
13 Lesser General Public License for more details.
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
3697
f7b03b6838cb Fixed bug #926
Sam Lantinga <slouken@libsdl.org>
parents: 3190
diff changeset
15 You should have received a copy of the GNU Lesser General Public
f7b03b6838cb Fixed bug #926
Sam Lantinga <slouken@libsdl.org>
parents: 3190
diff changeset
16 License along with this library; if not, write to the Free Software
f7b03b6838cb Fixed bug #926
Sam Lantinga <slouken@libsdl.org>
parents: 3190
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 */
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23 #include <GLES/gl.h>
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 #include <GLES/egl.h>
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 #include <dlfcn.h>
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 #if defined(__OpenBSD__) && !defined(__ELF__)
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27 #define dlsym(x,y) dlsym(x, "_" y)
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 #endif
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 #include "../SDL_sysvideo.h"
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 typedef struct SDL_PrivateGLESData
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 int egl_active; /* to stop switching drivers while we have a valid context */
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 XVisualInfo *egl_visualinfo;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36 EGLDisplay egl_display;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 EGLContext egl_context; /* Current GLES context */
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 EGLSurface egl_surface;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 EGLConfig egl_config;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 EGLDisplay(*eglGetDisplay) (NativeDisplayType display);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 EGLBoolean(*eglInitialize) (EGLDisplay dpy, EGLint * major,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 EGLint * minor);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44 EGLBoolean(*eglTerminate) (EGLDisplay dpy);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 void *(*eglGetProcAddress) (const GLubyte * procName);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48 EGLBoolean(*eglChooseConfig) (EGLDisplay dpy,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 const EGLint * attrib_list,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 EGLConfig * configs,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 EGLint config_size, EGLint * num_config);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53 EGLContext(*eglCreateContext) (EGLDisplay dpy,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 EGLConfig config,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 EGLContext share_list,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 const EGLint * attrib_list);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58 EGLBoolean(*eglDestroyContext) (EGLDisplay dpy, EGLContext ctx);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 EGLSurface(*eglCreateWindowSurface) (EGLDisplay dpy,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 EGLConfig config,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 NativeWindowType window,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63 const EGLint * attrib_list);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 EGLBoolean(*eglDestroySurface) (EGLDisplay dpy, EGLSurface surface);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 EGLBoolean(*eglMakeCurrent) (EGLDisplay dpy, EGLSurface draw,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 EGLSurface read, EGLContext ctx);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 EGLBoolean(*eglSwapBuffers) (EGLDisplay dpy, EGLSurface draw);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 const char *(*eglQueryString) (EGLDisplay dpy, EGLint name);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 EGLBoolean(*eglGetConfigAttrib) (EGLDisplay dpy, EGLConfig config,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74 EGLint attribute, EGLint * value);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 } SDL_PrivateGLESData;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 /* OpenGLES functions */
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 extern SDL_GLContext X11_GLES_CreateContext(_THIS, SDL_Window * window);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 extern XVisualInfo *X11_GLES_GetVisual(_THIS, Display * display, int screen);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81 extern int X11_GLES_MakeCurrent(_THIS, SDL_Window * window,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82 SDL_GLContext context);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83 extern int X11_GLES_GetAttribute(_THIS, SDL_GLattr attrib, int *value);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 extern int X11_GLES_LoadLibrary(_THIS, const char *path);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85 extern void *X11_GLES_GetProcAddress(_THIS, const char *proc);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 extern void X11_GLES_UnloadLibrary(_THIS);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88 extern int X11_GLES_SetSwapInterval(_THIS, int interval);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 extern int X11_GLES_GetSwapInterval(_THIS);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90 extern void X11_GLES_SwapWindow(_THIS, SDL_Window * window);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91 extern void X11_GLES_DeleteContext(_THIS, SDL_GLContext context);