"texture %i", src, src_tex_id, tex_id);
/* FIXME: try and avoid creating and destroying fbo's every copy... */
- if (!gl->BlitFramebuffer) {
+ if (!gl->BlitFramebuffer || (!gl->DrawBuffer && !gl->DrawBuffers)
+ || !gl->ReadBuffer) {
/* create a framebuffer object */
n_fbos = 1;
gl->GenFramebuffers (n_fbos, &fbo[0]);
gl->DeleteFramebuffers (n_fbos, &fbo[0]);
} else {
+ GLenum multipleRT[] = {
+ GL_COLOR_ATTACHMENT0,
+ GL_COLOR_ATTACHMENT1,
+ GL_COLOR_ATTACHMENT2
+ };
+
/* create a framebuffer object */
n_fbos = 2;
gl->GenFramebuffers (n_fbos, &fbo[0]);
gst_gl_query_start_log (GST_GL_BASE_MEMORY_CAST (src)->query,
GST_CAT_GL_MEMORY, GST_LEVEL_LOG, NULL, "%s", "BlitFramebuffer took");
gl->ReadBuffer (GL_COLOR_ATTACHMENT0);
- gl->DrawBuffer (GL_COLOR_ATTACHMENT0);
+ if (gl->DrawBuffers)
+ gl->DrawBuffers (1, multipleRT);
+ else
+ gl->DrawBuffer (GL_COLOR_ATTACHMENT0);
gl->BlitFramebuffer (0, 0, out_width, out_height,
0, 0, out_width, out_height, GL_COLOR_BUFFER_BIT, GL_NEAREST);
gst_gl_query_end (GST_GL_BASE_MEMORY_CAST (src)->query);
gl->BindFramebuffer (GL_READ_FRAMEBUFFER, 0);
gl->DeleteFramebuffers (n_fbos, &fbo[0]);
+
+ if (gl->DrawBuffer)
+ gl->DrawBuffer (GL_NONE);
}
gst_memory_unmap (GST_MEMORY_CAST (src), &sinfo);