zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_egl.h
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
4 
5  This software is provided 'as-is', without any express or implied
6  warranty. In no event will the authors be held liable for any damages
7  arising from the use of this software.
8 
9  Permission is granted to anyone to use this software for any purpose,
10  including commercial applications, and to alter it and redistribute it
11  freely, subject to the following restrictions:
12 
13  1. The origin of this software must not be misrepresented; you must not
14  claim that you wrote the original software. If you use this software
15  in a product, an acknowledgment in the product documentation would be
16  appreciated but is not required.
17  2. Altered source versions must be plainly marked as such, and must not be
18  misrepresented as being the original software.
19  3. This notice may not be removed or altered from any source distribution.
20 */
21 #include "SDL_config.h"
22 
23 #ifndef _SDL_egl_h
24 #define _SDL_egl_h
25 
26 #if SDL_VIDEO_OPENGL_EGL
27 
28 #include <EGL/egl.h>
29 
30 #include <dlfcn.h>
31 #if defined(__OpenBSD__) && !defined(__ELF__)
32 #define dlsym(x,y) dlsym(x, "_" y)
33 #endif
34 
35 #include "SDL_sysvideo.h"
36 
37 typedef struct SDL_EGL_VideoData
38 {
39  void *egl_dll_handle;
40  EGLDisplay egl_display;
41  EGLConfig egl_config;
42  int egl_swapinterval;
43 
46  EGLint * minor);
48 
49  void *(*eglGetProcAddress) (const char * procName);
50 
52  const EGLint * attrib_list,
53  EGLConfig * configs,
54  EGLint config_size, EGLint * num_config);
55 
58  EGLContext share_list,
59  const EGLint * attrib_list);
60 
62 
65  NativeWindowType window,
66  const EGLint * attrib_list);
68 
70  EGLSurface read, EGLContext ctx);
71 
73 
75 
76  const char *(*eglQueryString) (EGLDisplay dpy, EGLint name);
77 
80 
81  EGLBoolean(*eglWaitNative) (EGLint engine);
82 
84 } SDL_EGL_VideoData;
85 
86 /* OpenGLES functions */
87 extern int SDL_EGL_GetAttribute(_THIS, SDL_GLattr attrib, int *value);
88 extern int SDL_EGL_LoadLibrary(_THIS, const char *path, NativeDisplayType native_display);
89 extern void *SDL_EGL_GetProcAddress(_THIS, const char *proc);
90 extern void SDL_EGL_UnloadLibrary(_THIS);
91 extern int SDL_EGL_ChooseConfig(_THIS);
92 extern int SDL_EGL_SetSwapInterval(_THIS, int interval);
93 extern int SDL_EGL_GetSwapInterval(_THIS);
94 extern void SDL_EGL_DeleteContext(_THIS, SDL_GLContext context);
95 extern EGLSurface *SDL_EGL_CreateSurface(_THIS, NativeWindowType nw);
96 extern void SDL_EGL_DestroySurface(_THIS, EGLSurface egl_surface);
97 
98 /* These need to be wrapped to get the surface for the window by the platform GLES implementation */
99 extern SDL_GLContext SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface);
100 extern int SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context);
101 extern void SDL_EGL_SwapBuffers(_THIS, EGLSurface egl_surface);
102 
103 /* A few of useful macros */
104 
105 #define SDL_EGL_SwapWindow_impl(BACKEND) void \
106 BACKEND ## _GLES_SwapWindow(_THIS, SDL_Window * window) \
107 {\
108  SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);\
109 }
110 
111 #define SDL_EGL_MakeCurrent_impl(BACKEND) int \
112 BACKEND ## _GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) \
113 {\
114  if (window && context) { \
115  return SDL_EGL_MakeCurrent(_this, ((SDL_WindowData *) window->driverdata)->egl_surface, context); \
116  }\
117  else {\
118  return SDL_EGL_MakeCurrent(_this, NULL, NULL);\
119  }\
120 }
121 
122 #define SDL_EGL_CreateContext_impl(BACKEND) SDL_GLContext \
123 BACKEND ## _GLES_CreateContext(_THIS, SDL_Window * window) \
124 {\
125  return SDL_EGL_CreateContext(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);\
126 }
127 
128 #endif /* SDL_VIDEO_OPENGL_EGL */
129 
130 #endif /* _SDL_egl_h */
131 
132 /* vi: set ts=4 sw=4 expandtab: */
EGLSurface EGLint attribute
Definition: eglext.h:301
EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy)
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
Definition: glew.h:1824
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list)
void * EGLConfig
Definition: egl.h:46
EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
EGLSurface surface
Definition: eglext.h:74
SDL_GLattr
OpenGL configuration attributes.
Definition: SDL_video.h:166
void * SDL_GLContext
An opaque handle to an OpenGL context.
Definition: SDL_video.h:161
EGLImageKHR EGLint * name
Definition: eglext.h:284
khronos_int32_t EGLint
Definition: eglplatform.h:127
EGLSurface const EGLint * attrib_list
Definition: eglext.h:74
void * EGLDisplay
Definition: egl.h:48
char * display
Definition: visualinfo.c:85
EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
GLsizei const GLchar *const * path
Definition: glew.h:5828
void * EGLSurface
Definition: egl.h:49
unsigned int EGLBoolean
Definition: egl.h:44
EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
EGLNativeWindowType NativeWindowType
Definition: eglplatform.h:117
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
void * EGLContext
Definition: egl.h:47
#define _THIS
EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id)
EGLSurface EGLint void ** value
Definition: eglext.h:301
EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
EGLConfig config
Definition: eglext.h:257
EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void)
EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval)
EGLNativeDisplayType NativeDisplayType
Definition: eglplatform.h:115
EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine)
TParseContext * context
EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list)
Display * dpy
EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
EGLContext ctx
Definition: eglext.h:87