src/video/x11/SDL_x11opengles.c
author Sam Lantinga <slouken@libsdl.org>
Sun, 08 Jan 2012 02:23:37 -0500
changeset 6188 e82023802002
parent 6138 4c64952a58fb
child 6190 519380462400
permissions -rwxr-xr-x
Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11 Scott Percival 2011-07-03 06:41:51 PDT This submission is aimed at making life easier for OpenGL ES capable devices running a X11 stack (e.g. Maemo, Meego, TrimSlice, other ARM SoC boards not running Android). SDL's Pandora support already has the neccesary GLES-to-X11 glue code, however it's all ghetto'd off in Makefile.pandora and not very flexible. The patch: - adds an awesome --enable-video-opengles option to configure - re-modifies the opengles and opengles2 SDL_renderers to use function pointers - no idea why this was removed? - for SDL_Renderers, links in libGLESv1_CM, libGLES_CM (for PowerVR fans) or libGLESv2 at runtime - links in libEGL.so at runtime - the old code made an assumption that eglFunctions could be pulled from the active GLES library, PowerVR for one doesn't let you do that with their libGLESv2 - allows you to pick which of GLES v1 or v2 to load via SDL_GL_CONTEXT_MAJOR_VERSION So far I've tested this on a Nokia N900 (OMAP 3430/SGX 530 running Maemo 5) and a Toshiba AC100 (Tegra 2 running Ubuntu 10.10). I haven't tested it on... well, everything that isn't those two, such as a Pandora, iOS or Android device. The Pandora specific code should be kept intact (fingers crossed), and nothing painfully drastic has been added to the SDL_renderers. The library loading sequence in SDL_x11opengles has been updated to accomodate both NVIDIA's propensity to let developers get away with murder and PowerVR's alternative of punishing every missed step. The test apps work okay with GLES or GLES2 as the renderer. For some reason alpha blending doesn't seem to work on the Tegra 2; last week NVIDIA pushed out a new set of X11 GLES drivers, so I'll try and investigate once I upgrade those. Also, this patch adds things to configure.in, include/SDL_config.h.in and test/configure.in. I didn't know what the policy was re. committing generated spaghetti from autotools, so ./autogen.sh has to be run again. Sorry. I think that's about everything, let me know if there's anything I've overlooked.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     1
/*
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     2
  Simple DirectMedia Layer
6138
4c64952a58fb Happy New Year!
Sam Lantinga <slouken@libsdl.org>
parents: 6044
diff changeset
     3
  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     4
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     5
  This software is provided 'as-is', without any express or implied
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     6
  warranty.  In no event will the authors be held liable for any damages
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     7
  arising from the use of this software.
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     8
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     9
  Permission is granted to anyone to use this software for any purpose,
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    10
  including commercial applications, and to alter it and redistribute it
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    11
  freely, subject to the following restrictions:
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    12
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    13
  1. The origin of this software must not be misrepresented; you must not
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    14
     claim that you wrote the original software. If you use this software
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    15
     in a product, an acknowledgment in the product documentation would be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    16
     appreciated but is not required.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    17
  2. Altered source versions must be plainly marked as such, and must not be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    18
     misrepresented as being the original software.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    19
  3. This notice may not be removed or altered from any source distribution.
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    20
*/
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    21
#include "SDL_config.h"
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    22
6044
35448a5ea044 Lots of fixes importing SDL source wholesale into a new iOS project
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
    23
#if SDL_VIDEO_DRIVER_X11 && SDL_VIDEO_OPENGL_ES
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    24
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    25
#include "SDL_x11video.h"
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    26
#include "SDL_x11opengles.h"
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    27
6188
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
    28
#define DEFAULT_EGL "/usr/lib/libEGL.so"
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
    29
#define DEFAULT_OGL_ES2 "/usr/lib/libGLESv2.so"
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
    30
#define DEFAULT_OGL_ES_PVR "/usr/lib/libGLES_CM.so"
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
    31
#define DEFAULT_OGL_ES "/usr/lib/libGLESv1_CM.so"
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    32
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    33
#define LOAD_FUNC(NAME) \
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    34
	*((void**)&_this->gles_data->NAME) = dlsym(handle, #NAME); \
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    35
	if (!_this->gles_data->NAME) \
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    36
	{ \
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    37
		SDL_SetError("Could not retrieve EGL function " #NAME); \
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    38
		return -1; \
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    39
	}
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    40
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    41
/* GLES implementation of SDL OpenGL support */
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    42
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    43
void *
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    44
X11_GLES_GetProcAddress(_THIS, const char *proc)
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    45
{
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    46
    static char procname[1024];
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    47
    void *handle;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    48
    void *retval;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    49
6188
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
    50
    handle = _this->gles_data->egl_dll_handle;
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    51
    if (_this->gles_data->eglGetProcAddress) {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    52
        retval = _this->gles_data->eglGetProcAddress(proc);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    53
        if (retval) {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    54
            return retval;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    55
        }
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    56
    }
6188
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
    57
    
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
    58
    handle = _this->gl_config.dll_handle;
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    59
#if defined(__OpenBSD__) && !defined(__ELF__)
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    60
#undef dlsym(x,y);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    61
#endif
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    62
    retval = dlsym(handle, proc);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    63
    if (!retval && strlen(proc) <= 1022) {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    64
        procname[0] = '_';
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    65
        strcpy(procname + 1, proc);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    66
        retval = dlsym(handle, procname);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    67
    }
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    68
    return retval;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    69
}
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    70
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    71
void
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    72
X11_GLES_UnloadLibrary(_THIS)
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    73
{
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    74
    if (_this->gl_config.driver_loaded) {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    75
        _this->gles_data->eglTerminate(_this->gles_data->egl_display);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    76
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    77
        dlclose(_this->gl_config.dll_handle);
6188
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
    78
        dlclose(_this->gles_data->egl_dll_handle);
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    79
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    80
        _this->gles_data->eglGetProcAddress = NULL;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    81
        _this->gles_data->eglChooseConfig = NULL;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    82
        _this->gles_data->eglCreateContext = NULL;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    83
        _this->gles_data->eglCreateWindowSurface = NULL;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    84
        _this->gles_data->eglDestroyContext = NULL;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    85
        _this->gles_data->eglDestroySurface = NULL;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    86
        _this->gles_data->eglMakeCurrent = NULL;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    87
        _this->gles_data->eglSwapBuffers = NULL;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    88
        _this->gles_data->eglGetDisplay = NULL;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    89
        _this->gles_data->eglTerminate = NULL;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    90
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    91
        _this->gl_config.dll_handle = NULL;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    92
        _this->gl_config.driver_loaded = 0;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    93
    }
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    94
}
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    95
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    96
int
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    97
X11_GLES_LoadLibrary(_THIS, const char *path)
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    98
{
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    99
    void *handle;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   100
    int dlopen_flags;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   101
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   102
    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   103
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   104
    if (_this->gles_data->egl_active) {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   105
        SDL_SetError("OpenGL ES context already created");
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   106
        return -1;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   107
    }
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   108
#ifdef RTLD_GLOBAL
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   109
    dlopen_flags = RTLD_LAZY | RTLD_GLOBAL;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   110
#else
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   111
    dlopen_flags = RTLD_LAZY;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   112
#endif
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   113
    handle = dlopen(path, dlopen_flags);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   114
    /* Catch the case where the application isn't linked with EGL */
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   115
    if ((dlsym(handle, "eglChooseConfig") == NULL) && (path == NULL)) {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   116
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   117
        dlclose(handle);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   118
        path = getenv("SDL_VIDEO_GL_DRIVER");
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   119
        if (path == NULL) {
6188
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   120
            path = DEFAULT_EGL;
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   121
        }
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   122
        handle = dlopen(path, dlopen_flags);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   123
    }
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   124
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   125
    if (handle == NULL) {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   126
        SDL_SetError("Could not load OpenGL ES/EGL library");
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   127
        return -1;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   128
    }
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   129
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   130
    /* Unload the old driver and reset the pointers */
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   131
    X11_GLES_UnloadLibrary(_this);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   132
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   133
    /* Load new function pointers */
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   134
    LOAD_FUNC(eglGetDisplay);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   135
    LOAD_FUNC(eglInitialize);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   136
    LOAD_FUNC(eglTerminate);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   137
    LOAD_FUNC(eglGetProcAddress);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   138
    LOAD_FUNC(eglChooseConfig);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   139
    LOAD_FUNC(eglGetConfigAttrib);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   140
    LOAD_FUNC(eglCreateContext);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   141
    LOAD_FUNC(eglDestroyContext);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   142
    LOAD_FUNC(eglCreateWindowSurface);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   143
    LOAD_FUNC(eglDestroySurface);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   144
    LOAD_FUNC(eglMakeCurrent);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   145
    LOAD_FUNC(eglSwapBuffers);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   146
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   147
    _this->gles_data->egl_display =
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   148
        _this->gles_data->eglGetDisplay((NativeDisplayType) data->display);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   149
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   150
    if (!_this->gles_data->egl_display) {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   151
        SDL_SetError("Could not get EGL display");
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   152
        return -1;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   153
    }
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   154
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   155
    if (_this->gles_data->
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   156
        eglInitialize(_this->gles_data->egl_display, NULL,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   157
                      NULL) != EGL_TRUE) {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   158
        SDL_SetError("Could not initialize EGL");
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   159
        return -1;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   160
    }
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   161
6188
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   162
    _this->gles_data->egl_dll_handle = handle;
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   163
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   164
    path = getenv("SDL_VIDEO_GL_DRIVER");
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   165
    handle = dlopen(path, dlopen_flags);
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   166
    if ((path == NULL) | (handle == NULL)) {
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   167
        if (_this->gl_config.major_version > 1) {
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   168
            path = DEFAULT_OGL_ES2;
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   169
            handle = dlopen(path, dlopen_flags);
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   170
        } else {
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   171
            path = DEFAULT_OGL_ES;
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   172
            handle = dlopen(path, dlopen_flags);
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   173
            if (handle == NULL) {
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   174
                path = DEFAULT_OGL_ES_PVR;
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   175
                handle = dlopen(path, dlopen_flags);
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   176
            }
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   177
        }
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   178
    }
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   179
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   180
    if (handle == NULL) {
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   181
        SDL_SetError("Could not initialize OpenGL ES library");
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   182
        return -1;
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   183
    }
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   184
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   185
    _this->gl_config.dll_handle = handle;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   186
    _this->gl_config.driver_loaded = 1;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   187
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   188
    if (path) {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   189
        strncpy(_this->gl_config.driver_path, path,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   190
                sizeof(_this->gl_config.driver_path) - 1);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   191
    } else {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   192
        strcpy(_this->gl_config.driver_path, "");
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   193
    }
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   194
    return 0;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   195
}
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   196
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   197
XVisualInfo *
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   198
X11_GLES_GetVisual(_THIS, Display * display, int screen)
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   199
{
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   200
    /* 64 seems nice. */
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   201
    EGLint attribs[64];
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   202
    EGLint found_configs = 0;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   203
    VisualID visual_id;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   204
    int i;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   205
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   206
    /* load the gl driver from a default path */
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   207
    if (!_this->gl_config.driver_loaded) {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   208
        /* no driver has been loaded, use default (ourselves) */
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   209
        if (X11_GLES_LoadLibrary(_this, NULL) < 0) {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   210
            return NULL;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   211
        }
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   212
    }
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   213
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   214
    i = 0;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   215
    attribs[i++] = EGL_RED_SIZE;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   216
    attribs[i++] = _this->gl_config.red_size;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   217
    attribs[i++] = EGL_GREEN_SIZE;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   218
    attribs[i++] = _this->gl_config.green_size;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   219
    attribs[i++] = EGL_BLUE_SIZE;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   220
    attribs[i++] = _this->gl_config.blue_size;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   221
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   222
    if (_this->gl_config.alpha_size) {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   223
        attribs[i++] = EGL_ALPHA_SIZE;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   224
        attribs[i++] = _this->gl_config.alpha_size;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   225
    }
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   226
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   227
    if (_this->gl_config.buffer_size) {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   228
        attribs[i++] = EGL_BUFFER_SIZE;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   229
        attribs[i++] = _this->gl_config.buffer_size;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   230
    }
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   231
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   232
    attribs[i++] = EGL_DEPTH_SIZE;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   233
    attribs[i++] = _this->gl_config.depth_size;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   234
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   235
    if (_this->gl_config.stencil_size) {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   236
        attribs[i++] = EGL_STENCIL_SIZE;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   237
        attribs[i++] = _this->gl_config.stencil_size;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   238
    }
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   239
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   240
    if (_this->gl_config.multisamplebuffers) {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   241
        attribs[i++] = EGL_SAMPLE_BUFFERS;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   242
        attribs[i++] = _this->gl_config.multisamplebuffers;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   243
    }
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   244
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   245
    if (_this->gl_config.multisamplesamples) {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   246
        attribs[i++] = EGL_SAMPLES;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   247
        attribs[i++] = _this->gl_config.multisamplesamples;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   248
    }
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   249
6188
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   250
    attribs[i++] = EGL_RENDERABLE_TYPE;
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   251
    if (_this->gl_config.major_version == 2) {
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   252
        attribs[i++] = EGL_OPENGL_ES2_BIT;
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   253
    } else {
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   254
        attribs[i++] = EGL_OPENGL_ES_BIT;
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   255
    }
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   256
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   257
    attribs[i++] = EGL_NONE;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   258
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   259
    if (_this->gles_data->eglChooseConfig(_this->gles_data->egl_display,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   260
                                          attribs,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   261
                                          &_this->gles_data->egl_config, 1,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   262
                                          &found_configs) == EGL_FALSE ||
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   263
        found_configs == 0) {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   264
        SDL_SetError("Couldn't find matching EGL config");
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   265
        return NULL;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   266
    }
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   267
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   268
    if (_this->gles_data->eglGetConfigAttrib(_this->gles_data->egl_display,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   269
                                             _this->gles_data->egl_config,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   270
                                             EGL_NATIVE_VISUAL_ID,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   271
                                             (EGLint *) & visual_id) ==
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   272
        EGL_FALSE || !visual_id) {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   273
        /* Use the default visual when all else fails */
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   274
        XVisualInfo vi_in;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   275
        int out_count;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   276
        vi_in.screen = screen;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   277
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   278
        _this->gles_data->egl_visualinfo = XGetVisualInfo(display,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   279
                                                          VisualScreenMask,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   280
                                                          &vi_in, &out_count);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   281
    } else {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   282
        XVisualInfo vi_in;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   283
        int out_count;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   284
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   285
        vi_in.screen = screen;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   286
        vi_in.visualid = visual_id;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   287
        _this->gles_data->egl_visualinfo = XGetVisualInfo(display,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   288
                                                          VisualScreenMask |
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   289
                                                          VisualIDMask,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   290
                                                          &vi_in, &out_count);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   291
    }
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   292
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   293
    return _this->gles_data->egl_visualinfo;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   294
}
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   295
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   296
SDL_GLContext
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   297
X11_GLES_CreateContext(_THIS, SDL_Window * window)
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   298
{
6188
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   299
    EGLint context_attrib_list[] = {
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   300
        EGL_CONTEXT_CLIENT_VERSION,
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   301
        1,
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   302
        EGL_NONE
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   303
    };
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   304
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   305
    SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   306
    Display *display = data->videodata->display;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   307
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   308
    XSync(display, False);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   309
6188
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   310
    if (_this->gl_config.major_version) {
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   311
        context_attrib_list[1] = _this->gl_config.major_version;
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   312
    }
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   313
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   314
    _this->gles_data->egl_context =
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   315
        _this->gles_data->eglCreateContext(_this->gles_data->egl_display,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   316
                                           _this->gles_data->egl_config,
6188
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   317
                                           EGL_NO_CONTEXT, context_attrib_list);
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   318
    XSync(display, False);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   319
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   320
    if (_this->gles_data->egl_context == EGL_NO_CONTEXT) {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   321
        SDL_SetError("Could not create EGL context");
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   322
        return NULL;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   323
    }
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   324
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   325
    _this->gles_data->egl_active = 1;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   326
6188
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   327
    if (X11_GLES_MakeCurrent(_this, window, context) < 0) {
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   328
        X11_GLES_DeleteContext(_this, context);
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   329
        return NULL;
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   330
    }
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   331
6188
e82023802002 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   332
    return (SDL_GLContext)(1);
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   333
}
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   334
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   335
int
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   336
X11_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   337
{
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   338
    int retval;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   339
3218
81773a1eac83 Patch from David Carre:
Sam Lantinga <slouken@libsdl.org>
parents: 3190
diff changeset
   340
//    SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
81773a1eac83 Patch from David Carre:
Sam Lantinga <slouken@libsdl.org>
parents: 3190
diff changeset
   341
//    Display *display = data->videodata->display;
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   342
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   343
    retval = 1;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   344
    if (!_this->gles_data->eglMakeCurrent(_this->gles_data->egl_display,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   345
                                          _this->gles_data->egl_surface,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   346
                                          _this->gles_data->egl_surface,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   347
                                          _this->gles_data->egl_context)) {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   348
        SDL_SetError("Unable to make EGL context current");
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   349
        retval = -1;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   350
    }
3218
81773a1eac83 Patch from David Carre:
Sam Lantinga <slouken@libsdl.org>
parents: 3190
diff changeset
   351
//    XSync(display, False);
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   352
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   353
    return (retval);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   354
}
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   355
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   356
static int swapinterval = -1;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   357
int
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   358
X11_GLES_SetSwapInterval(_THIS, int interval)
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   359
{
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   360
    return 0;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   361
}
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   362
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   363
int
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   364
X11_GLES_GetSwapInterval(_THIS)
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   365
{
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   366
    return 0;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   367
}
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   368
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   369
void
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   370
X11_GLES_SwapWindow(_THIS, SDL_Window * window)
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   371
{
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   372
    _this->gles_data->eglSwapBuffers(_this->gles_data->egl_display,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   373
                                     _this->gles_data->egl_surface);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   374
}
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   375
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   376
void
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   377
X11_GLES_DeleteContext(_THIS, SDL_GLContext context)
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   378
{
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   379
    /* Clean up GLES and EGL */
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   380
    if (_this->gles_data->egl_context != EGL_NO_CONTEXT ||
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   381
        _this->gles_data->egl_surface != EGL_NO_SURFACE) {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   382
        _this->gles_data->eglMakeCurrent(_this->gles_data->egl_display,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   383
                                         EGL_NO_SURFACE, EGL_NO_SURFACE,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   384
                                         EGL_NO_CONTEXT);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   385
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   386
        if (_this->gles_data->egl_context != EGL_NO_CONTEXT) {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   387
            _this->gles_data->eglDestroyContext(_this->gles_data->egl_display,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   388
                                                _this->gles_data->
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   389
                                                egl_context);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   390
            _this->gles_data->egl_context = EGL_NO_CONTEXT;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   391
        }
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   392
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   393
        if (_this->gles_data->egl_surface != EGL_NO_SURFACE) {
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   394
            _this->gles_data->eglDestroySurface(_this->gles_data->egl_display,
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   395
                                                _this->gles_data->
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   396
                                                egl_surface);
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   397
            _this->gles_data->egl_surface = EGL_NO_SURFACE;
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   398
        }
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   399
    }
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   400
    _this->gles_data->egl_active = 0;
3218
81773a1eac83 Patch from David Carre:
Sam Lantinga <slouken@libsdl.org>
parents: 3190
diff changeset
   401
81773a1eac83 Patch from David Carre:
Sam Lantinga <slouken@libsdl.org>
parents: 3190
diff changeset
   402
/* crappy fix */
81773a1eac83 Patch from David Carre:
Sam Lantinga <slouken@libsdl.org>
parents: 3190
diff changeset
   403
    X11_GLES_UnloadLibrary(_this);
81773a1eac83 Patch from David Carre:
Sam Lantinga <slouken@libsdl.org>
parents: 3190
diff changeset
   404
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   405
}
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   406
6044
35448a5ea044 Lots of fixes importing SDL source wholesale into a new iOS project
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
   407
#endif /* SDL_VIDEO_DRIVER_X11 && SDL_VIDEO_OPENGL_ES */
3190
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   408
c68d2ca5970f Added missing files for OpenGL ES support
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   409
/* vi: set ts=4 sw=4 expandtab: */