gl->BindFramebuffer (GL_READ_FRAMEBUFFER, this->source->renderTargetId());
- ret = gst_gl_context_check_framebuffer_status (context);
+ ret = gst_gl_context_check_framebuffer_status (context, GL_READ_FRAMEBUFFER);
if (!ret) {
GST_ERROR ("FBO errors");
goto errors;
gl->FramebufferTexture2D (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D, dst_tex, 0);
- ret = gst_gl_context_check_framebuffer_status (context);
+ ret = gst_gl_context_check_framebuffer_status (context, GL_DRAW_FRAMEBUFFER);
if (!ret) {
GST_ERROR ("FBO errors");
goto errors;
* Since: 1.10
*/
gboolean
-gst_gl_context_check_framebuffer_status (GstGLContext * context)
+gst_gl_context_check_framebuffer_status (GstGLContext * context, GLenum fbo_target)
{
g_return_val_if_fail (GST_IS_GL_CONTEXT (context), FALSE);
- switch (context->gl_vtable->CheckFramebufferStatus (GL_FRAMEBUFFER)) {
+ if (fbo_target != GL_FRAMEBUFFER && fbo_target != GL_READ_FRAMEBUFFER
+ && fbo_target != GL_DRAW_FRAMEBUFFER) {
+ GST_ERROR_OBJECT (context, "fbo target is invalid");
+ return FALSE;
+ }
+
+ switch (context->gl_vtable->CheckFramebufferStatus (fbo_target)) {
case GL_FRAMEBUFFER_COMPLETE:
return TRUE;
break;
gl->FramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
gst_gl_texture_target_to_gl (gl_mem->tex_target), gl_mem->tex_id, 0);
- if (!gst_gl_context_check_framebuffer_status (context)) {
+ if (!gst_gl_context_check_framebuffer_status (context, GL_FRAMEBUFFER)) {
GST_CAT_WARNING (GST_CAT_GL_MEMORY,
"Could not create framebuffer to read pixels for memory %p", gl_mem);
gl->DeleteFramebuffers (1, &fbo);
gl->FramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
gst_gl_texture_target_to_gl (src->tex_target), src_tex_id, 0);
- if (!gst_gl_context_check_framebuffer_status (src->mem.context))
+ if (!gst_gl_context_check_framebuffer_status (src->mem.context, GL_FRAMEBUFFER))
goto fbo_error;
gl->BindTexture (out_tex_target, tex_id);
gl->FramebufferTexture2D (GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
gst_gl_texture_target_to_gl (src->tex_target), src_tex_id, 0);
- if (!gst_gl_context_check_framebuffer_status (src->mem.context))
+ if (!gst_gl_context_check_framebuffer_status (src->mem.context, GL_READ_FRAMEBUFFER))
goto fbo_error;
gl->BindFramebuffer (GL_DRAW_FRAMEBUFFER, fbo[1]);
gl->FramebufferTexture2D (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
gst_gl_texture_target_to_gl (src->tex_target), tex_id, 0);
- if (!gst_gl_context_check_framebuffer_status (src->mem.context))
+ if (!gst_gl_context_check_framebuffer_status (src->mem.context, GL_DRAW_FRAMEBUFFER))
goto fbo_error;
gl->BindTexture (out_tex_target, tex_id);