4 * Copyright (C) 2011-2013 Scott R. Smith
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
36 /** Defines (in every case choose only one) */
38 /** DEBUG : enable additional error monitoring per EGL function call */
39 /** Native display and window system for use with EGL */
40 /** USE_EGL_SDL : used for access to a SDL X11 window */
41 /** Platform: settings that are specific to that device */
42 /** PANDORA (USE_GLES1 or USE_GLES2) */
43 /** WIZ (USE_GLES1) */
44 /** CAANOO (USE_GLES1) */
45 /** RPI (USE_GLES1 or USE_GLES2) */
47 /** USE_GLES1 : EGL for use with OpenGL-ES 1.X contexts */
48 /** USE_GLES2 : EGL for use with OpenGL-ES 2.0 contexts */
51 void EGL_Close ( void );
52 int8_t EGL_Open ( uint16_t width, uint16_t height );
53 void EGL_SwapBuffers ( void );
55 extern int8_t eglColorbits;
56 extern int8_t eglDepthbits;
57 extern int8_t eglStencilbits;
59 /** Simple Examples */
61 EGL_Open( window_width, window_height );
69 SDL_Init( SDL_INIT_VIDEO );
70 SDL_Surface* screen = SDL_SetVideoMode(640, 480, 16, SDL_SWSURFACE|SDL_FULLSCREEN);
71 EGL_Open( window_width, window_height );
81 #define GET_EGLERROR(FUNCTION) \
84 CheckEGLErrors(__FILE__, __LINE__); \
87 #define GET_EGLERROR(FUNCTION) FUNCTION;
90 #define peglQueryString(A,B) GET_EGLERROR(eglQueryString(A,B))
91 #define peglDestroyContext(A,B) GET_EGLERROR(eglDestroyContext(A,B))
92 #define peglDestroySurface(A,B) GET_EGLERROR(eglDestroySurface(A,B))
93 #define peglTerminate(A) GET_EGLERROR(eglTerminate(A))
94 #define peglSwapBuffers(A,B) GET_EGLERROR(eglSwapBuffers(A,B))
95 #define peglGetDisplay(A) GET_EGLERROR(eglGetDisplay(A))
96 #define peglBindAPI(A) GET_EGLERROR(eglBindAPI(A))
97 #define peglCreateContext(A,B,C,D) GET_EGLERROR(eglCreateContext(A,B,C,D))
98 #define peglCreateWindowSurface(A,B,C,D) GET_EGLERROR(eglCreateWindowSurface(A,B,C,D))
99 #define peglInitialize(A,B,C) GET_EGLERROR(eglInitialize(A,B,C))
100 #define peglMakeCurrent(A,B,C,D) GET_EGLERROR(eglMakeCurrent(A,B,C,D))
101 #define peglChooseConfig(A,B,C,D,E) GET_EGLERROR(eglChooseConfig(A,B,C,D,E))
102 #define peglSwapInterval(A,B) GET_EGLERROR(eglSwapInterval(A,B))
108 #endif /* EGLPORT_H */