src/video/x11/SDL_x11opengles.h
changeset 3190 c68d2ca5970f
child 3697 f7b03b6838cb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/video/x11/SDL_x11opengles.h	Wed Jun 10 13:54:13 2009 +0000
     1.3 @@ -0,0 +1,95 @@
     1.4 +/*
     1.5 +    SDL - Simple DirectMedia Layer
     1.6 +    Copyright (C) 1997-2004 Sam Lantinga
     1.7 +
     1.8 +    This library is free software; you can redistribute it and/or
     1.9 +    modify it under the terms of the GNU Library General Public
    1.10 +    License as published by the Free Software Foundation; either
    1.11 +    version 2 of the License, or (at your option) any later version.
    1.12 +
    1.13 +    This library is distributed in the hope that it will be useful,
    1.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.16 +    Library General Public License for more details.
    1.17 +
    1.18 +    You should have received a copy of the GNU Library General Public
    1.19 +    License along with this library; if not, write to the Free
    1.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.21 +
    1.22 +    Sam Lantinga
    1.23 +    slouken@libsdl.org
    1.24 +
    1.25 +    Open Pandora SDL driver
    1.26 +    Copyright (C) 2009 David Carré
    1.27 +    (cpasjuste@gmail.com)
    1.28 +*/
    1.29 +
    1.30 +#include <GLES/gl.h>
    1.31 +#include <GLES/egl.h>
    1.32 +#include <dlfcn.h>
    1.33 +#if defined(__OpenBSD__) && !defined(__ELF__)
    1.34 +#define dlsym(x,y) dlsym(x, "_" y)
    1.35 +#endif
    1.36 +
    1.37 +#include "../SDL_sysvideo.h"
    1.38 +
    1.39 +typedef struct SDL_PrivateGLESData
    1.40 +{
    1.41 +    int egl_active;             /* to stop switching drivers while we have a valid context */
    1.42 +    XVisualInfo *egl_visualinfo;
    1.43 +    EGLDisplay egl_display;
    1.44 +    EGLContext egl_context;     /* Current GLES context */
    1.45 +    EGLSurface egl_surface;
    1.46 +    EGLConfig egl_config;
    1.47 +
    1.48 +      EGLDisplay(*eglGetDisplay) (NativeDisplayType display);
    1.49 +      EGLBoolean(*eglInitialize) (EGLDisplay dpy, EGLint * major,
    1.50 +                                  EGLint * minor);
    1.51 +      EGLBoolean(*eglTerminate) (EGLDisplay dpy);
    1.52 +
    1.53 +    void *(*eglGetProcAddress) (const GLubyte * procName);
    1.54 +
    1.55 +      EGLBoolean(*eglChooseConfig) (EGLDisplay dpy,
    1.56 +                                    const EGLint * attrib_list,
    1.57 +                                    EGLConfig * configs,
    1.58 +                                    EGLint config_size, EGLint * num_config);
    1.59 +
    1.60 +      EGLContext(*eglCreateContext) (EGLDisplay dpy,
    1.61 +                                     EGLConfig config,
    1.62 +                                     EGLContext share_list,
    1.63 +                                     const EGLint * attrib_list);
    1.64 +
    1.65 +      EGLBoolean(*eglDestroyContext) (EGLDisplay dpy, EGLContext ctx);
    1.66 +
    1.67 +      EGLSurface(*eglCreateWindowSurface) (EGLDisplay dpy,
    1.68 +                                           EGLConfig config,
    1.69 +                                           NativeWindowType window,
    1.70 +                                           const EGLint * attrib_list);
    1.71 +      EGLBoolean(*eglDestroySurface) (EGLDisplay dpy, EGLSurface surface);
    1.72 +
    1.73 +      EGLBoolean(*eglMakeCurrent) (EGLDisplay dpy, EGLSurface draw,
    1.74 +                                   EGLSurface read, EGLContext ctx);
    1.75 +
    1.76 +      EGLBoolean(*eglSwapBuffers) (EGLDisplay dpy, EGLSurface draw);
    1.77 +
    1.78 +    const char *(*eglQueryString) (EGLDisplay dpy, EGLint name);
    1.79 +
    1.80 +      EGLBoolean(*eglGetConfigAttrib) (EGLDisplay dpy, EGLConfig config,
    1.81 +                                       EGLint attribute, EGLint * value);
    1.82 +
    1.83 +} SDL_PrivateGLESData;
    1.84 +
    1.85 +/* OpenGLES functions */
    1.86 +extern SDL_GLContext X11_GLES_CreateContext(_THIS, SDL_Window * window);
    1.87 +extern XVisualInfo *X11_GLES_GetVisual(_THIS, Display * display, int screen);
    1.88 +extern int X11_GLES_MakeCurrent(_THIS, SDL_Window * window,
    1.89 +                                SDL_GLContext context);
    1.90 +extern int X11_GLES_GetAttribute(_THIS, SDL_GLattr attrib, int *value);
    1.91 +extern int X11_GLES_LoadLibrary(_THIS, const char *path);
    1.92 +extern void *X11_GLES_GetProcAddress(_THIS, const char *proc);
    1.93 +extern void X11_GLES_UnloadLibrary(_THIS);
    1.94 +
    1.95 +extern int X11_GLES_SetSwapInterval(_THIS, int interval);
    1.96 +extern int X11_GLES_GetSwapInterval(_THIS);
    1.97 +extern void X11_GLES_SwapWindow(_THIS, SDL_Window * window);
    1.98 +extern void X11_GLES_DeleteContext(_THIS, SDL_GLContext context);