From 77c0b2803159eb365fc5887b9360ec60d65486a1 Mon Sep 17 00:00:00 2001 From: Filippo Argiolas Date: Sun, 10 Aug 2008 11:22:34 +0200 Subject: [PATCH] [141/906] some steps towards simplification. added a convenience function to gstglfilter and some comment here and there --- gst-libs/gst/gl/gstgldisplay.c | 7 +++++++ gst-libs/gst/gl/gstglfilter.c | 16 ++++++++++++++++ gst-libs/gst/gl/gstglfilter.h | 7 +++++++ gst/gl/gstglfilterblur.c | 18 ++++-------------- 4 files changed, 34 insertions(+), 14 deletions(-) diff --git a/gst-libs/gst/gl/gstgldisplay.c b/gst-libs/gst/gl/gstgldisplay.c index 1dfc3a2471..67aa1032c1 100644 --- a/gst-libs/gst/gl/gstgldisplay.c +++ b/gst-libs/gst/gl/gstgldisplay.c @@ -1996,6 +1996,13 @@ gst_gl_display_gen_fbo (GstGLDisplay* display, gint width, gint height, /* Called by glfilter */ +/* this function really has to be simplified... do we really need to + set projection this way? Wouldn't be better a set_projection + separate call? or just make glut functions available out of + gst-libs and call it if needed on drawcallback? -- Filippo */ +/* GLCB too.. I think that only needed parameters should be + * GstGLDisplay *display and gpointer data, or just gpointer data */ +/* ..everything here has to be simplified! */ gboolean gst_gl_display_use_fbo (GstGLDisplay* display, gint texture_fbo_width, gint texture_fbo_height, GLuint fbo, GLuint depth_buffer, GLuint texture_fbo, GLCB cb, diff --git a/gst-libs/gst/gl/gstglfilter.c b/gst-libs/gst/gl/gstglfilter.c index 816d4e12d3..1d753af873 100644 --- a/gst-libs/gst/gl/gstglfilter.c +++ b/gst-libs/gst/gl/gstglfilter.c @@ -315,3 +315,19 @@ gst_gl_filter_do_transform (GstGLFilter* filter, return TRUE; } + +/* convenience functions to simplify filter development */ + +void +gst_gl_filter_render_to_target (GstGLFilter *filter, + GLuint input, GLuint target, + GLCB func, gpointer data) +{ + gst_gl_display_use_fbo (filter->display, filter->width, filter->height, + filter->fbo, filter->depthbuffer, target, + func, + filter->width, filter->height, input, + 0, filter->width, 0, filter->height, + GST_GL_DISPLAY_PROJECTION_ORTHO2D, + data); +} diff --git a/gst-libs/gst/gl/gstglfilter.h b/gst-libs/gst/gl/gstglfilter.h index 8dbcc86aae..1c0286ee59 100644 --- a/gst-libs/gst/gl/gstglfilter.h +++ b/gst-libs/gst/gl/gstglfilter.h @@ -72,6 +72,13 @@ struct _GstGLFilterClass GType gst_gl_filter_get_type(void); + +void +gst_gl_filter_render_to_target (GstGLFilter *filter, + GLuint input, GLuint target, + GLCB func, gpointer data); + + G_END_DECLS #endif diff --git a/gst/gl/gstglfilterblur.c b/gst/gl/gstglfilterblur.c index eb923c4058..fd0d43d0cf 100644 --- a/gst/gl/gstglfilterblur.c +++ b/gst/gl/gstglfilterblur.c @@ -206,20 +206,10 @@ gst_gl_filterblur_filter (GstGLFilter* filter, GstGLBuffer* inbuf, //blocking call, generate a texture using the pool gst_gl_display_gen_texture (filter->display, &midtexture) ; - //blocking call, use a FBO - gst_gl_display_use_fbo (filter->display, filter->width, filter->height, - filter->fbo, filter->depthbuffer, midtexture, gst_gl_filterblur_hcallback, - inbuf->width, inbuf->height, inbuf->texture, - 0, filter->width, 0, filter->height, - GST_GL_DISPLAY_PROJECTION_ORTHO2D, filterblur); - - - //blocking call, use a FBO - gst_gl_display_use_fbo (filter->display, filter->width, filter->height, - filter->fbo, filter->depthbuffer, outbuf->texture, gst_gl_filterblur_vcallback, - inbuf->width, inbuf->height, midtexture, - 0, filter->width, 0, filter->height, - GST_GL_DISPLAY_PROJECTION_ORTHO2D, filterblur); + gst_gl_filter_render_to_target (filter, inbuf->texture, midtexture, + gst_gl_filterblur_hcallback, filterblur); + gst_gl_filter_render_to_target (filter, midtexture, outbuf->texture, + gst_gl_filterblur_vcallback, filterblur); //blocking call, put the texture in the pool gst_gl_display_del_texture (filter->display, midtexture);