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