src/video/x11/SDL_x11opengles.h
author Sam Lantinga <slouken@libsdl.org>
Fri, 15 Feb 2013 08:47:44 -0800
changeset 6885 700f1b25f77f
parent 6370 93187f7f7d5d
child 7659 ac4ce59c40e7
permissions -rw-r--r--
Happy New Year!
     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_x11opengles_h
    24 #define _SDL_x11opengles_h
    25 
    26 #if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
    27 #include <GLES/gl.h>
    28 #include <GLES/egl.h>
    29 #include <dlfcn.h>
    30 #if defined(__OpenBSD__) && !defined(__ELF__)
    31 #define dlsym(x,y) dlsym(x, "_" y)
    32 #endif
    33 
    34 #include "../SDL_sysvideo.h"
    35 
    36 typedef struct SDL_PrivateGLESData
    37 {
    38     XVisualInfo *egl_visualinfo;
    39     void *egl_dll_handle;
    40     EGLDisplay egl_display;
    41     EGLContext egl_context;     /* Current GLES context */
    42     EGLSurface egl_surface;
    43     EGLConfig egl_config;
    44     int egl_swapinterval;
    45 
    46       EGLDisplay(*eglGetDisplay) (NativeDisplayType display);
    47       EGLBoolean(*eglInitialize) (EGLDisplay dpy, EGLint * major,
    48                                   EGLint * minor);
    49       EGLBoolean(*eglTerminate) (EGLDisplay dpy);
    50 
    51     void *(*eglGetProcAddress) (const char * procName);
    52 
    53       EGLBoolean(*eglChooseConfig) (EGLDisplay dpy,
    54                                     const EGLint * attrib_list,
    55                                     EGLConfig * configs,
    56                                     EGLint config_size, EGLint * num_config);
    57 
    58       EGLContext(*eglCreateContext) (EGLDisplay dpy,
    59                                      EGLConfig config,
    60                                      EGLContext share_list,
    61                                      const EGLint * attrib_list);
    62 
    63       EGLBoolean(*eglDestroyContext) (EGLDisplay dpy, EGLContext ctx);
    64 
    65       EGLSurface(*eglCreateWindowSurface) (EGLDisplay dpy,
    66                                            EGLConfig config,
    67                                            NativeWindowType window,
    68                                            const EGLint * attrib_list);
    69       EGLBoolean(*eglDestroySurface) (EGLDisplay dpy, EGLSurface surface);
    70 
    71       EGLBoolean(*eglMakeCurrent) (EGLDisplay dpy, EGLSurface draw,
    72                                    EGLSurface read, EGLContext ctx);
    73 
    74       EGLBoolean(*eglSwapBuffers) (EGLDisplay dpy, EGLSurface draw);
    75 
    76       EGLBoolean(*eglSwapInterval) (EGLDisplay dpy, EGLint interval);
    77 
    78     const char *(*eglQueryString) (EGLDisplay dpy, EGLint name);
    79 
    80       EGLBoolean(*eglGetConfigAttrib) (EGLDisplay dpy, EGLConfig config,
    81                                        EGLint attribute, EGLint * value);
    82 
    83 } SDL_PrivateGLESData;
    84 
    85 /* OpenGLES functions */
    86 extern SDL_GLContext X11_GLES_CreateContext(_THIS, SDL_Window * window);
    87 extern XVisualInfo *X11_GLES_GetVisual(_THIS, Display * display, int screen);
    88 extern int X11_GLES_MakeCurrent(_THIS, SDL_Window * window,
    89                                 SDL_GLContext context);
    90 extern int X11_GLES_GetAttribute(_THIS, SDL_GLattr attrib, int *value);
    91 extern int X11_GLES_LoadLibrary(_THIS, const char *path);
    92 extern void *X11_GLES_GetProcAddress(_THIS, const char *proc);
    93 extern void X11_GLES_UnloadLibrary(_THIS);
    94 
    95 extern int X11_GLES_SetSwapInterval(_THIS, int interval);
    96 extern int X11_GLES_GetSwapInterval(_THIS);
    97 extern void X11_GLES_SwapWindow(_THIS, SDL_Window * window);
    98 extern void X11_GLES_DeleteContext(_THIS, SDL_GLContext context);
    99 
   100 #endif /* SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 */
   101 
   102 #endif /* _SDL_x11opengles_h */
   103 
   104 /* vi: set ts=4 sw=4 expandtab: */