Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
More OpenGL ES fixes from Scott Percival
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jul 19, 2012
1 parent 0f4393c commit 6fe1704
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/video/x11/SDL_x11opengl.c
Expand Up @@ -128,9 +128,9 @@ X11_GL_LoadLibrary(_THIS, const char *path)
return -1;
}

#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
/* If SDL_GL_CONTEXT_EGL has been changed to 1, switch over to X11_GLES functions */
if (_this->gl_config.use_egl == 1) {
#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
_this->GL_LoadLibrary = X11_GLES_LoadLibrary;
_this->GL_GetProcAddress = X11_GLES_GetProcAddress;
_this->GL_UnloadLibrary = X11_GLES_UnloadLibrary;
Expand All @@ -141,8 +141,11 @@ X11_GL_LoadLibrary(_THIS, const char *path)
_this->GL_SwapWindow = X11_GLES_SwapWindow;
_this->GL_DeleteContext = X11_GLES_DeleteContext;
return X11_GLES_LoadLibrary(_this, path);
}
#else
SDL_SetError("SDL not configured with OpenGL ES/EGL support");
return -1;
#endif
}


/* Load the OpenGL library */
Expand Down
7 changes: 5 additions & 2 deletions src/video/x11/SDL_x11opengles.c
Expand Up @@ -99,9 +99,9 @@ X11_GLES_LoadLibrary(_THIS, const char *path)
return -1;
}

#if SDL_VIDEO_OPENGL_GLX
/* If SDL_GL_CONTEXT_EGL has been changed to 0, switch over to X11_GL functions */
if (_this->gl_config.use_egl == 0) {
#if SDL_VIDEO_OPENGL_GLX
_this->GL_LoadLibrary = X11_GL_LoadLibrary;
_this->GL_GetProcAddress = X11_GL_GetProcAddress;
_this->GL_UnloadLibrary = X11_GL_UnloadLibrary;
Expand All @@ -112,8 +112,11 @@ X11_GLES_LoadLibrary(_THIS, const char *path)
_this->GL_SwapWindow = X11_GL_SwapWindow;
_this->GL_DeleteContext = X11_GL_DeleteContext;
return X11_GL_LoadLibrary(_this, path);
}
#else
SDL_SetError("SDL not configured with OpenGL/GLX support");
return -1;
#endif
}

#ifdef RTLD_GLOBAL
dlopen_flags = RTLD_LAZY | RTLD_GLOBAL;
Expand Down
8 changes: 7 additions & 1 deletion src/video/x11/SDL_x11window.c
Expand Up @@ -391,7 +391,12 @@ X11_CreateWindow(_THIS, SDL_Window * window)
return -1;
}
#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
if (window->flags & SDL_WINDOW_OPENGL) {
if ((window->flags & SDL_WINDOW_OPENGL) && (_this->gl_config.use_egl == 1)) {
if (!_this->gles_data) {
XDestroyWindow(display, w);
return -1;
}

/* Create the GLES window surface */
_this->gles_data->egl_surface =
_this->gles_data->eglCreateWindowSurface(_this->gles_data->
Expand All @@ -401,6 +406,7 @@ X11_CreateWindow(_THIS, SDL_Window * window)

if (_this->gles_data->egl_surface == EGL_NO_SURFACE) {
SDL_SetError("Could not create GLES window surface");
XDestroyWindow(display, w);
return -1;
}
}
Expand Down

0 comments on commit 6fe1704

Please sign in to comment.