gltestsrc.h \
gstgltestsrc.c \
gstgltestsrc.h \
- gstgleffects.c \
+ gstgleffects.c \
effects/gstgleffects.h \
- effects/gstgleffectsources.h \
+ effects/gstgleffectssources.c \
+ effects/gstgleffectssources.h \
+ effects/gstgleffectidentity.c \
effects/gstgleffectmirror.c
$(GST_PLUGINS_BASE_CFLAGS) $(GL_CFLAGS) \
-I$(top_srcdir)/gst-libs \
-I$(top_srcdir)/gst-libs/gst/freeglut \
- -I$(top_srcdir)/gst-libs/gst/gl
+ -I$(top_srcdir)/gst-libs/gst/gl \
+ -I$(top_srcdir)/gst/gl/effects
libgstopengl_la_LIBADD = \
$(top_builddir)/gst-libs/gst/freeglut/libgstfreeglut-$(GST_MAJORMINOR).la \
$(top_builddir)/gst-libs/gst/gl/libgstgl-$(GST_MAJORMINOR).la \
--- /dev/null
+/*
+ * GStreamer
+ * Copyright (C) 2008 Filippo Argiolas <filippo.argiolas@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <gstgleffects.h>
+
+static void
+gst_gl_effects_identity_callback (gint width, gint height, guint texture, gpointer data)
+{
+ GstGLEffects* effects = GST_GL_EFFECTS (data);
+
+ glMatrixMode (GL_PROJECTION);
+ glLoadIdentity ();
+
+ gst_gl_effects_draw_texture (effects, texture);
+}
+
+void
+gst_gl_effects_identity (GstGLEffects *effects) {
+ GstGLFilter *filter = GST_GL_FILTER (effects);
+
+ gst_gl_filter_render_to_target (filter, effects->intexture, effects->outtexture,
+ gst_gl_effects_identity_callback, effects);
+}
* Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstgleffects.h"
-#include "gstgleffectssources.h"
+#include <gstgleffects.h>
static void
gst_gl_effects_mirror_callback (gint width, gint height, guint texture, gpointer data)
#endif
#include <gstglfilter.h>
+#include <gstgleffectssources.h>
G_BEGIN_DECLS
+
#define GST_TYPE_GL_EFFECTS (gst_gl_effects_get_type())
#define GST_GL_EFFECTS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_GL_EFFECTS,GstGLEffects))
#define GST_IS_GL_EFFECTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_GL_EFFECTS))
GstGLFilterClass filter_class;
};
+enum
+{
+ PROP_0,
+ PROP_EFFECT
+};
+
+
GType gst_gl_effects_get_type (void);
void gst_gl_effects_draw_texture (GstGLEffects * effects, GLuint tex);
+void gst_gl_effects_identity (GstGLEffects *effects);
void gst_gl_effects_mirror (GstGLEffects *effects);
G_END_DECLS
* Boston, MA 02111-1307, USA.
*/
+#include <gstgleffects.h>
+
#ifndef __GST_GL_EFFECTS_SOURCES_H__
#define __GST_GL_EFFECTS_SOURCES_H__
-/* Mirror effect */
-static const gchar *mirror_fragment_source =
- "#extension GL_ARB_texture_rectangle : enable\n"
- "uniform sampler2DRect tex;"
- "uniform float width, height;"
- "void main () {"
- " vec2 tex_size = vec2 (width, height);"
- " vec2 texturecoord = gl_TexCoord[0].xy;"
- " vec2 normcoord;"
- " normcoord = texturecoord / tex_size - 1.0;"
- " normcoord.x *= sign (normcoord.x);"
- " texturecoord = (normcoord + 1.0) * tex_size;"
- " vec4 color = texture2DRect (tex, texturecoord); "
- " gl_FragColor = color * gl_Color;"
- "}";
+const gchar *mirror_fragment_source;
#endif /* __GST_GL_EFFECTS_SOURCES_H__ */
* Boston, MA 02111-1307, USA.
*/
-#include "effects/gstgleffects.h"
+#include <gstgleffects.h>
#define GST_TYPE_GL_EFFECTS (gst_gl_effects_get_type())
#define GST_GL_EFFECTS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_GL_EFFECTS,GstGLEffects))
#define GST_IS_GL_EFFECTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) , GST_TYPE_GL_EFFECTS))
#define GST_GL_EFFECTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) , GST_TYPE_GL_EFFECTS,GstGLEffectsClass))
-typedef enum {
- GST_GL_EFFECT_IDENTITY,
- GST_GL_EFFECT_MIRROR,
- GST_GL_N_EFFECTS
-} GstGLEffectsEffect;
-
#define GST_CAT_DEFAULT gst_gl_effects_debug
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
static gboolean gst_gl_effects_filter (GstGLFilter * filter,
GstGLBuffer * inbuf, GstGLBuffer * outbuf);
+static const GstElementDetails element_details = GST_ELEMENT_DETAILS (
+ "Gstreamer OpenGL Effects",
+ "Filter/Effect",
+ "GL Shading Language effects",
+ "Filippo Argiolas <filippo.argiolas@gmail.com>");
+
+
+typedef enum {
+ GST_GL_EFFECT_IDENTITY,
+ GST_GL_EFFECT_MIRROR,
+ GST_GL_N_EFFECTS
+} GstGLEffectsEffect;
+
#define GST_TYPE_GL_EFFECTS_EFFECT (gst_gl_effects_effect_get_type ())
static GType
gst_gl_effects_effect_get_type (void)
return gl_effects_effect_type;
}
-static const GstElementDetails element_details = GST_ELEMENT_DETAILS (
- "Gstreamer OpenGL Effects",
- "Filter/Effect",
- "GL Shading Language effects",
- "Filippo Argiolas <filippo.argiolas@gmail.com>");
-
-enum
-{
- PROP_0,
- PROP_EFFECT
-};
-
+/* init resources that need a gl context */
static void
gst_gl_effects_init_gl_resources (GstGLFilter *filter)
{
}
}
+/* free resources that need a gl context */
static void
gst_gl_effects_reset_gl_resources (GstGLFilter *filter)
{
glEnd ();
}
-static void
-gst_gl_effects_identity_callback (gint width, gint height, guint texture, gpointer data)
-{
- GstGLEffects* effects = GST_GL_EFFECTS (data);
-
- glMatrixMode (GL_PROJECTION);
- glLoadIdentity ();
-
- gst_gl_effects_draw_texture (effects, texture);
-}
-
+#if 0
static void
change_view (GstGLDisplay *display, gpointer data)
{
glMatrixMode (GL_MODELVIEW);
glLoadMatrixd (mirrormatrix);
}
-
-static void
-gst_gl_effects_identity (GstGLEffects *effects) {
- GstGLFilter *filter = GST_GL_FILTER (effects);
-
- gst_gl_display_thread_add (filter->display, change_view, effects);
- gst_gl_filter_render_to_target (filter, effects->intexture, effects->outtexture,
- gst_gl_effects_identity_callback, effects);
-}
+#endif
static void
gst_gl_effects_init (GstGLEffects * effects, GstGLEffectsClass * klass)