if (!_this->egl_data) {
return SDL_SetError("OpenGL not initialized");
}
-
- /* The android emulator crashes badly if you try to eglMakeCurrent
- * with a valid context and invalid surface, so we have to check for both here.
- */
- if (!egl_context || !egl_surface) {
- _this->egl_data->eglMakeCurrent(_this->egl_data->egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
- } else {
+#ifdef __TIZEN__
+ if ((SDL_EGL_HasExtension(_this, "EGL_KHR_surfaceless_context")) && (!egl_surface)) {
if (!_this->egl_data->eglMakeCurrent(_this->egl_data->egl_display,
- egl_surface, egl_surface, egl_context)) {
- return SDL_SetError("Unable to make EGL context current");
+ EGL_NO_SURFACE , EGL_NO_SURFACE , egl_context)) {
+ return SDL_SetError("Unable to make EGL context current");
+ }
+ }
+ else
+#endif
+ {
+ /* The android emulator crashes badly if you try to eglMakeCurrent
+ * with a valid context and invalid surface, so we have to check for both here.
+ */
+ if (!egl_context || !egl_surface) {
+ _this->egl_data->eglMakeCurrent(_this->egl_data->egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ } else {
+ if (!_this->egl_data->eglMakeCurrent(_this->egl_data->egl_display,
+ egl_surface, egl_surface, egl_context)) {
+ return SDL_SetError("Unable to make EGL context current");
+ }
}
}
-
return 0;
}
return 0;
}
+#ifdef __TIZEN__
+ if ((SDL_GL_ExtensionSupported("EGL_KHR_surfaceless_context")) && (!window)) {
+ /* current window checking */
+ SDL_Window* cur_win = SDL_GL_GetCurrentWindow();
+ if (!ctx) cur_win = NULL;
+ CHECK_WINDOW_MAGIC(cur_win, -1);
+
+ if (!(cur_win->flags & SDL_WINDOW_OPENGL)) {
+ return SDL_SetError("The specified window isn't an OpenGL window");
+ }
+ retval = _this->GL_MakeCurrent(_this, NULL, ctx);
+ if (retval == 0) {
+ _this->current_glwin = cur_win;
+ _this->current_glctx = ctx;
+ SDL_TLSSet(_this->current_glwin_tls, cur_win, NULL);
+ SDL_TLSSet(_this->current_glctx_tls, ctx, NULL);
+ }
+ return retval;
+ }
+#endif
+
if (!ctx) {
window = NULL;
} else {