__block EAGLContext *context;
dispatch_sync(dispatch_get_main_queue(), ^{
- EAGLContext *cur_ctx = [EAGLContext currentContext];
- if (cur_ctx) {
- context = cur_ctx;
- } else {
- context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
- if (context == nil) {
- GST_ERROR_OBJECT (ctx->element, "Failed to create EAGL GLES2 context");
- }
+ context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
+ if (context == nil) {
+ GST_ERROR_OBJECT (ctx->element, "Failed to create EAGL GLES2 context");
}
});
return FALSE;
}
ctx_to_set = ctx->eaglctx->eagl_context;
- dispatch_sync(dispatch_get_main_queue(), ^{
- [EAGLContext setCurrentContext: ctx_to_set];
- });
-
} else {
GST_DEBUG_OBJECT (ctx->element, "Detaching context from thread %p",
g_thread_self ());
dispatch_sync(dispatch_get_main_queue(), ^{
+ gst_egl_adaptation_context_make_current (ctx, TRUE);
+
if (ctx->eaglctx->framebuffer) {
framebuffer = ctx->eaglctx->framebuffer;
} else {
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, width, height);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
GL_RENDERBUFFER, depthRenderbuffer);
+
+ gst_egl_adaptation_context_make_current (ctx, FALSE);
});
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);