src/video/x11/SDL_x11opengles.h
author Sam Lantinga <slouken@libsdl.org>
Sun, 24 Jan 2010 21:10:53 +0000
changeset 3697 f7b03b6838cb
parent 3190 c68d2ca5970f
child 5262 b530ef003506
permissions -rw-r--r--
Fixed bug #926

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