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!
slouken@3190
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@6885
     3
  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
slouken@3190
     4
slouken@5535
     5
  This software is provided 'as-is', without any express or implied
slouken@5535
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     7
  arising from the use of this software.
slouken@3190
     8
slouken@5535
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
    10
  including commercial applications, and to alter it and redistribute it
slouken@5535
    11
  freely, subject to the following restrictions:
slouken@3190
    12
slouken@5535
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@5535
    14
     claim that you wrote the original software. If you use this software
slouken@5535
    15
     in a product, an acknowledgment in the product documentation would be
slouken@5535
    16
     appreciated but is not required.
slouken@5535
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@5535
    18
     misrepresented as being the original software.
slouken@5535
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@3190
    20
*/
slouken@6370
    21
#include "SDL_config.h"
slouken@3190
    22
slouken@6370
    23
#ifndef _SDL_x11opengles_h
slouken@6370
    24
#define _SDL_x11opengles_h
slouken@6370
    25
slouken@6370
    26
#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
slouken@3190
    27
#include <GLES/gl.h>
slouken@3190
    28
#include <GLES/egl.h>
slouken@3190
    29
#include <dlfcn.h>
slouken@3190
    30
#if defined(__OpenBSD__) && !defined(__ELF__)
slouken@3190
    31
#define dlsym(x,y) dlsym(x, "_" y)
slouken@3190
    32
#endif
slouken@3190
    33
slouken@3190
    34
#include "../SDL_sysvideo.h"
slouken@3190
    35
slouken@3190
    36
typedef struct SDL_PrivateGLESData
slouken@3190
    37
{
slouken@3190
    38
    XVisualInfo *egl_visualinfo;
slouken@6188
    39
    void *egl_dll_handle;
slouken@3190
    40
    EGLDisplay egl_display;
slouken@3190
    41
    EGLContext egl_context;     /* Current GLES context */
slouken@3190
    42
    EGLSurface egl_surface;
slouken@3190
    43
    EGLConfig egl_config;
slouken@6190
    44
    int egl_swapinterval;
slouken@3190
    45
slouken@3190
    46
      EGLDisplay(*eglGetDisplay) (NativeDisplayType display);
slouken@3190
    47
      EGLBoolean(*eglInitialize) (EGLDisplay dpy, EGLint * major,
slouken@3190
    48
                                  EGLint * minor);
slouken@3190
    49
      EGLBoolean(*eglTerminate) (EGLDisplay dpy);
slouken@3190
    50
slouken@6190
    51
    void *(*eglGetProcAddress) (const char * procName);
slouken@3190
    52
slouken@3190
    53
      EGLBoolean(*eglChooseConfig) (EGLDisplay dpy,
slouken@3190
    54
                                    const EGLint * attrib_list,
slouken@3190
    55
                                    EGLConfig * configs,
slouken@3190
    56
                                    EGLint config_size, EGLint * num_config);
slouken@3190
    57
slouken@3190
    58
      EGLContext(*eglCreateContext) (EGLDisplay dpy,
slouken@3190
    59
                                     EGLConfig config,
slouken@3190
    60
                                     EGLContext share_list,
slouken@3190
    61
                                     const EGLint * attrib_list);
slouken@3190
    62
slouken@3190
    63
      EGLBoolean(*eglDestroyContext) (EGLDisplay dpy, EGLContext ctx);
slouken@3190
    64
slouken@3190
    65
      EGLSurface(*eglCreateWindowSurface) (EGLDisplay dpy,
slouken@3190
    66
                                           EGLConfig config,
slouken@3190
    67
                                           NativeWindowType window,
slouken@3190
    68
                                           const EGLint * attrib_list);
slouken@3190
    69
      EGLBoolean(*eglDestroySurface) (EGLDisplay dpy, EGLSurface surface);
slouken@3190
    70
slouken@3190
    71
      EGLBoolean(*eglMakeCurrent) (EGLDisplay dpy, EGLSurface draw,
slouken@3190
    72
                                   EGLSurface read, EGLContext ctx);
slouken@3190
    73
slouken@3190
    74
      EGLBoolean(*eglSwapBuffers) (EGLDisplay dpy, EGLSurface draw);
slouken@3190
    75
slouken@6190
    76
      EGLBoolean(*eglSwapInterval) (EGLDisplay dpy, EGLint interval);
slouken@6190
    77
slouken@3190
    78
    const char *(*eglQueryString) (EGLDisplay dpy, EGLint name);
slouken@3190
    79
slouken@3190
    80
      EGLBoolean(*eglGetConfigAttrib) (EGLDisplay dpy, EGLConfig config,
slouken@3190
    81
                                       EGLint attribute, EGLint * value);
slouken@3190
    82
slouken@3190
    83
} SDL_PrivateGLESData;
slouken@3190
    84
slouken@3190
    85
/* OpenGLES functions */
slouken@3190
    86
extern SDL_GLContext X11_GLES_CreateContext(_THIS, SDL_Window * window);
slouken@3190
    87
extern XVisualInfo *X11_GLES_GetVisual(_THIS, Display * display, int screen);
slouken@3190
    88
extern int X11_GLES_MakeCurrent(_THIS, SDL_Window * window,
slouken@3190
    89
                                SDL_GLContext context);
slouken@3190
    90
extern int X11_GLES_GetAttribute(_THIS, SDL_GLattr attrib, int *value);
slouken@3190
    91
extern int X11_GLES_LoadLibrary(_THIS, const char *path);
slouken@3190
    92
extern void *X11_GLES_GetProcAddress(_THIS, const char *proc);
slouken@3190
    93
extern void X11_GLES_UnloadLibrary(_THIS);
slouken@3190
    94
slouken@3190
    95
extern int X11_GLES_SetSwapInterval(_THIS, int interval);
slouken@3190
    96
extern int X11_GLES_GetSwapInterval(_THIS);
slouken@3190
    97
extern void X11_GLES_SwapWindow(_THIS, SDL_Window * window);
slouken@3190
    98
extern void X11_GLES_DeleteContext(_THIS, SDL_GLContext context);
slouken@6370
    99
slouken@6370
   100
#endif /* SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 */
slouken@6370
   101
slouken@6370
   102
#endif /* _SDL_x11opengles_h */
slouken@6370
   103
slouken@6370
   104
/* vi: set ts=4 sw=4 expandtab: */