gstglfilterglass.h \
gstglfilterapp.c \
gstglfilterapp.h \
- gstglfilterreflectedscreen.c \
- gstglfilterreflectedscreen.h \
gstgldeinterlace.c \
gstgldeinterlace.h \
gltestsrc.c \
if HAVE_PNG
OPENGL_SOURCES += \
- gstglbumper.c \
- gstglbumper.h \
gstgldifferencematte.c \
gstgldifferencematte.h
endif
static void gst_gl_filter_cube_reset (GstGLFilter * filter);
static void gst_gl_filter_cube_reset_gl (GstGLFilter * filter);
static gboolean gst_gl_filter_cube_init_shader (GstGLFilter * filter);
-static void _callback_gles2 (gint width, gint height, guint texture,
- gpointer stuff);
-#if GST_GL_HAVE_OPENGL
-static void _callback_opengl (gint width, gint height, guint texture,
- gpointer stuff);
-#endif
+static void _callback (gpointer stuff);
static gboolean gst_gl_filter_cube_filter_texture (GstGLFilter * filter,
guint in_tex, guint out_tex);
guint out_tex)
{
GstGLFilterCube *cube_filter = GST_GL_FILTER_CUBE (filter);
- GLCB cb = NULL;
- GstGLAPI api;
-
- api = gst_gl_context_get_gl_api (GST_GL_FILTER (cube_filter)->context);
-#if GST_GL_HAVE_OPENGL
- if (api & GST_GL_API_OPENGL)
- cb = _callback_opengl;
-#endif
- if (api & (GST_GL_API_GLES2 | GST_GL_API_OPENGL3))
- cb = _callback_gles2;
+ cube_filter->in_tex = in_tex;
/* blocking call, use a FBO */
- gst_gl_context_use_fbo (filter->context,
+ gst_gl_context_use_fbo_v2 (filter->context,
GST_VIDEO_INFO_WIDTH (&filter->out_info),
- GST_VIDEO_INFO_HEIGHT (&filter->out_info),
- filter->fbo, filter->depthbuffer, out_tex,
- cb,
- GST_VIDEO_INFO_WIDTH (&filter->in_info),
- GST_VIDEO_INFO_HEIGHT (&filter->in_info),
- in_tex, cube_filter->fovy, cube_filter->aspect,
- cube_filter->znear, cube_filter->zfar,
- GST_GL_DISPLAY_PROJECTION_PERSPECTIVE, (gpointer) cube_filter);
+ GST_VIDEO_INFO_HEIGHT (&filter->out_info), filter->fbo,
+ filter->depthbuffer, out_tex, _callback, (gpointer) cube_filter);
return TRUE;
}
};
/* *INDENT-ON* */
-/* opengl scene, params: input texture (not the output filter->texture) */
-#if GST_GL_HAVE_OPENGL
-static void
-_callback_opengl (gint width, gint height, guint texture, gpointer stuff)
-{
- GstGLFilterCube *cube_filter = GST_GL_FILTER_CUBE (stuff);
- GstGLFilter *filter = GST_GL_FILTER (stuff);
- GstGLFuncs *gl = filter->context->gl_vtable;
-
- static GLfloat xrot = 0;
- static GLfloat yrot = 0;
- static GLfloat zrot = 0;
-
- GLushort indices[] = {
- 0, 1, 2,
- 0, 2, 3,
- 4, 5, 6,
- 4, 6, 7,
- 8, 9, 10,
- 8, 10, 11,
- 12, 13, 14,
- 12, 14, 15,
- 16, 17, 18,
- 16, 18, 19,
- 20, 21, 22,
- 20, 22, 23
- };
-
- gl->Enable (GL_DEPTH_TEST);
-
- gl->Enable (GL_TEXTURE_2D);
- gl->BindTexture (GL_TEXTURE_2D, texture);
-
- gl->ClearColor (cube_filter->red, cube_filter->green, cube_filter->blue, 0.0);
- gl->Clear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- gl->MatrixMode (GL_PROJECTION);
- gluLookAt (0.0, 0.0, -6.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
- gl->MatrixMode (GL_MODELVIEW);
- gl->LoadIdentity ();
-
-// gl->Translatef (0.0f, 0.0f, -5.0f);
-
- gl->Rotatef (xrot, 1.0f, 0.0f, 0.0f);
- gl->Rotatef (yrot, 0.0f, 1.0f, 0.0f);
- gl->Rotatef (zrot, 0.0f, 0.0f, 1.0f);
-
- gl->ClientActiveTexture (GL_TEXTURE0);
- gl->EnableClientState (GL_TEXTURE_COORD_ARRAY);
- gl->EnableClientState (GL_VERTEX_ARRAY);
-
- gl->VertexPointer (3, GL_FLOAT, 5 * sizeof (float), vertices);
- gl->TexCoordPointer (2, GL_FLOAT, 5 * sizeof (float), &vertices[3]);
-
- gl->DrawElements (GL_TRIANGLES, 36, GL_UNSIGNED_SHORT, indices);
-
- gl->DisableClientState (GL_TEXTURE_COORD_ARRAY);
- gl->DisableClientState (GL_VERTEX_ARRAY);
-
- gl->Disable (GL_DEPTH_TEST);
-
- xrot += 0.3f;
- yrot += 0.2f;
- zrot += 0.4f;
-}
-#endif
-
static void
_bind_buffer (GstGLFilterCube * cube_filter)
{
}
static void
-_callback_gles2 (gint width, gint height, guint texture, gpointer stuff)
+_callback (gpointer stuff)
{
GstGLFilter *filter = GST_GL_FILTER (stuff);
GstGLFilterCube *cube_filter = GST_GL_FILTER_CUBE (filter);
gst_gl_shader_use (cube_filter->shader);
gl->ActiveTexture (GL_TEXTURE0);
- gl->BindTexture (GL_TEXTURE_2D, texture);
+ gl->BindTexture (GL_TEXTURE_2D, cube_filter->in_tex);
gst_gl_shader_set_uniform_1i (cube_filter->shader, "s_texture", 0);
gst_gl_shader_set_uniform_1f (cube_filter->shader, "xrot_degree", xrot);
gst_gl_shader_set_uniform_1f (cube_filter->shader, "yrot_degree", yrot);
gdouble znear;
gdouble zfar;
+ guint in_tex;
GLuint vao;
GLuint vertex_buffer;
GLint attr_position;
} else {
gl->Viewport (0, 0, width, height);
}
-#if GST_GL_HAVE_OPENGL
- if (USING_OPENGL (gl_sink->context)) {
- gl->MatrixMode (GL_PROJECTION);
- gl->LoadIdentity ();
- gluOrtho2D (0, width, 0, height);
- gl->MatrixMode (GL_MODELVIEW);
- }
-#endif
}
}
#include "gstglfilterlaplacian.h"
#include "gstglfilterglass.h"
#include "gstglfilterblur.h"
-#include "gstglfilterreflectedscreen.h"
+/* #include "gstglfilterreflectedscreen.h" */
#include "gstglfiltersobel.h"
#include "gstgldeinterlace.h"
#include "gstglmosaic.h"
#if HAVE_PNG
#include "gstgldifferencematte.h"
-#include "gstglbumper.h"
+/* #include "gstglbumper.h" */
#endif /* HAVE_PNG */
#endif /* GST_GL_HAVE_OPENGL */
GST_RANK_NONE, GST_TYPE_GL_FILTER_GLASS)) {
return FALSE;
}
-
+#if 0
if (!gst_element_register (plugin, "glfilterreflectedscreen",
GST_RANK_NONE, GST_TYPE_GL_FILTER_REFLECTED_SCREEN)) {
return FALSE;
}
-
+#endif
if (!gst_element_register (plugin, "gldeinterlace",
GST_RANK_NONE, GST_TYPE_GL_DEINTERLACE)) {
return FALSE;
GST_RANK_NONE, gst_gl_differencematte_get_type ())) {
return FALSE;
}
-
+#if 0
if (!gst_element_register (plugin, "glbumper",
GST_RANK_NONE, gst_gl_bumper_get_type ())) {
return FALSE;
}
+#endif
#endif /* HAVE_PNG */
#endif /* GST_GL_HAVE_OPENGL */
# define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
# include <OpenGL/gl3.h>
# endif
-# include <OpenGL/glu.h>
# else
# include <GL/gl.h>
-# include <GL/glu.h>
# if __WIN32__ || _WIN32
# include <GL/glext.h>
# endif
}
gboolean
-gst_gl_framebuffer_use (GstGLFramebuffer * frame, gint texture_fbo_width,
- gint texture_fbo_height, GLuint fbo, GLuint depth_buffer,
- GLuint texture_fbo, GLCB cb, gint input_tex_width,
- gint input_tex_height, GLuint input_tex, gdouble proj_param1,
- gdouble proj_param2, gdouble proj_param3, gdouble proj_param4,
- GstGLDisplayProjection projection, gpointer stuff)
-{
- const GstGLFuncs *gl;
-#if GST_GL_HAVE_GLES2
- GLint viewport_dim[4];
-#endif
-
- g_return_val_if_fail (GST_IS_GL_FRAMEBUFFER (frame), FALSE);
- g_return_val_if_fail (input_tex_width > 0 && input_tex_height > 0, FALSE);
- g_return_val_if_fail (texture_fbo_width > 0 && texture_fbo_height > 0, FALSE);
- g_return_val_if_fail (input_tex != 0, FALSE);
- g_return_val_if_fail (fbo != 0, FALSE);
- g_return_val_if_fail (texture_fbo != 0, FALSE);
- g_return_val_if_fail (cb != NULL, FALSE);
-
- gl = frame->context->gl_vtable;
-
- GST_TRACE ("Binding v1 FBO %u dimensions:%ux%u with texture:%u "
- "dimensions:%ux%u", fbo, texture_fbo_width,
- texture_fbo_height, texture_fbo, input_tex_width, input_tex_height);
-
- gl->BindFramebuffer (GL_FRAMEBUFFER, fbo);
-
- /*setup a texture to render to */
- gl->BindTexture (GL_TEXTURE_2D, texture_fbo);
-
- /* attach the texture to the FBO to renderer to */
- gl->FramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- GL_TEXTURE_2D, texture_fbo, 0);
-
- gst_gl_context_clear_shader (frame->context);
-
-#if GST_GL_HAVE_OPENGL
- if (gst_gl_context_get_gl_api (frame->context) & GST_GL_API_OPENGL) {
- gl->PushAttrib (GL_VIEWPORT_BIT);
- gl->MatrixMode (GL_PROJECTION);
- gl->PushMatrix ();
- gl->LoadIdentity ();
-
- switch (projection) {
- case GST_GL_DISPLAY_PROJECTION_ORTHO2D:
- gluOrtho2D (proj_param1, proj_param2, proj_param3, proj_param4);
- break;
- case GST_GL_DISPLAY_PROJECTION_PERSPECTIVE:
- gluPerspective (proj_param1, proj_param2, proj_param3, proj_param4);
- break;
- default:
- gst_gl_context_set_error (frame->context, "Unknow fbo projection %d",
- projection);
- }
-
- gl->MatrixMode (GL_MODELVIEW);
- gl->PushMatrix ();
- gl->LoadIdentity ();
- }
-#endif
-#if GST_GL_HAVE_GLES2
- if (gst_gl_context_get_gl_api (frame->context) & GST_GL_API_GLES2)
- gl->GetIntegerv (GL_VIEWPORT, viewport_dim);
-#endif
-
- gl->Viewport (0, 0, texture_fbo_width, texture_fbo_height);
-
-#if GST_GL_HAVE_OPENGL
- if (gst_gl_context_get_gl_api (frame->context) & GST_GL_API_OPENGL) {
- const GLenum rt[] = { GL_COLOR_ATTACHMENT0 };
- gl->DrawBuffers (1, rt);
- }
-#endif
-
- gl->ClearColor (0.0, 0.0, 0.0, 0.0);
- gl->Clear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- cb (input_tex_width, input_tex_height, input_tex, stuff);
-
-#if GST_GL_HAVE_OPENGL
- if (gst_gl_context_get_gl_api (frame->context) & GST_GL_API_OPENGL) {
- const GLenum rt[] = { GL_NONE };
- gl->DrawBuffers (1, rt);
- gl->MatrixMode (GL_PROJECTION);
- gl->PopMatrix ();
- gl->MatrixMode (GL_MODELVIEW);
- gl->PopMatrix ();
- gl->PopAttrib ();
- }
-#endif
-#if GST_GL_HAVE_GLES2
- if (gst_gl_context_get_gl_api (frame->context) & GST_GL_API_GLES2) {
- gl->Viewport (viewport_dim[0], viewport_dim[1], viewport_dim[2],
- viewport_dim[3]);
- }
-#endif
-
- gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
-
- return TRUE;
-}
-
-gboolean
gst_gl_framebuffer_use_v2 (GstGLFramebuffer * frame, gint texture_fbo_width,
gint texture_fbo_height, GLuint fbo, GLuint depth_buffer,
GLuint texture_fbo, GLCB_V2 cb, gpointer stuff)
gboolean gst_gl_framebuffer_generate (GstGLFramebuffer *frame, gint width, gint height,
guint * fbo, guint * depthbuffer);
-gboolean gst_gl_framebuffer_use (GstGLFramebuffer * frame, gint texture_fbo_width,
- gint texture_fbo_height, GLuint fbo, GLuint depth_buffer,
- GLuint texture_fbo, GLCB cb, gint input_tex_width,
- gint input_tex_height, GLuint input_tex, gdouble proj_param1,
- gdouble proj_param2, gdouble proj_param3, gdouble proj_param4,
- GstGLDisplayProjection projection, gpointer stuff);
-
gboolean gst_gl_framebuffer_use_v2 (GstGLFramebuffer * frame, gint texture_fbo_width,
gint texture_fbo_height, GLuint fbo, GLuint depth_buffer,
GLuint texture_fbo, GLCB_V2 cb, gpointer stuff);
return TRUE;
}
-typedef struct _UseFBO
-{
- GstGLFramebuffer *frame;
- gint texture_fbo_width;
- gint texture_fbo_height;
- GLuint fbo;
- GLuint depth_buffer;
- GLuint texture_fbo;
- GLCB cb;
- gint input_tex_width;
- gint input_tex_height;
- GLuint input_tex;
- gdouble proj_param1;
- gdouble proj_param2;
- gdouble proj_param3;
- gdouble proj_param4;
- GstGLDisplayProjection projection;
- gpointer stuff;
-} UseFBO;
-
-static void
-_use_fbo (GstGLContext * context, UseFBO * data)
-{
- gst_gl_framebuffer_use (data->frame, data->texture_fbo_width,
- data->texture_fbo_height, data->fbo, data->depth_buffer,
- data->texture_fbo, data->cb, data->input_tex_width,
- data->input_tex_height, data->input_tex, data->proj_param1,
- data->proj_param2, data->proj_param3, data->proj_param4, data->projection,
- data->stuff);
-}
-
-/* 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_context_use_fbo (GstGLContext * context, gint texture_fbo_width,
- gint texture_fbo_height, GLuint fbo, GLuint depth_buffer,
- GLuint texture_fbo, GLCB cb, gint input_tex_width,
- gint input_tex_height, GLuint input_tex, gdouble proj_param1,
- gdouble proj_param2, gdouble proj_param3, gdouble proj_param4,
- GstGLDisplayProjection projection, gpointer stuff)
-{
- GstGLFramebuffer *frame = gst_gl_framebuffer_new (context);
-
- UseFBO data =
- { frame, texture_fbo_width, texture_fbo_height, fbo, depth_buffer,
- texture_fbo, cb, input_tex_width, input_tex_height, input_tex,
- proj_param1, proj_param2, proj_param3, proj_param4, projection, stuff
- };
-
- gst_gl_context_thread_add (context, (GstGLContextThreadFunc) _use_fbo, &data);
-
- gst_object_unref (frame);
-
- return TRUE;
-}
-
typedef struct _UseFBO2
{
GstGLFramebuffer *frame;
gboolean gst_gl_context_gen_fbo (GstGLContext * context, gint width, gint height,
GLuint * fbo, GLuint * depthbuffer);
-gboolean gst_gl_context_use_fbo (GstGLContext * context, gint texture_fbo_width,
- gint texture_fbo_height, GLuint fbo, GLuint depth_buffer,
- GLuint texture_fbo, GLCB cb, gint input_texture_width,
- gint input_texture_height, GLuint input_texture, gdouble proj_param1,
- gdouble proj_param2, gdouble proj_param3, gdouble proj_param4,
- GstGLDisplayProjection projection, gpointer stuff);
gboolean gst_gl_context_use_fbo_v2 (GstGLContext * context, gint texture_fbo_width,
gint texture_fbo_height, GLuint fbo, GLuint depth_buffer,
GLuint texture_fbo, GLCB_V2 cb, gpointer stuff);
*/
#include <GL/gl.h>
-#include <GL/glu.h>
#if __WIN32__ || _WIN32
# include <GL/glext.h>
#endif
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- gluPerspective(45, (gfloat)width/(gfloat)height, 0.1, 100);
glMatrixMode(GL_MODELVIEW);
return TRUE;
*/
#include <GL/gl.h>
-#include <GL/glu.h>
#if __WIN32__ || _WIN32
# include <GL/glext.h>
#endif
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- gluPerspective(45, (gfloat)width/(gfloat)height, 0.1, 100);
glMatrixMode(GL_MODELVIEW);
return TRUE;
*/
#include <GL/gl.h>
-#include <GL/glu.h>
#if __WIN32__ || _WIN32
# include <GL/glext.h>
#endif
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- gluPerspective(45, (gfloat)width/(gfloat)height, 0.1, 100);
glMatrixMode(GL_MODELVIEW);
return TRUE;
*/
#include <GL/gl.h>
-#include <GL/glu.h>
#if __WIN32__ || _WIN32
# include <GL/glext.h>
#endif
#include <gst/video/videooverlay.h>
#include <GL/gl.h>
-#include <GL/glu.h>
#include "pipeline.h"
Pipeline::Pipeline(const WId id, const QString videoLocation):
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- gluPerspective(45, (gfloat)width/(gfloat)height, 0.1, 100);
glMatrixMode(GL_MODELVIEW);
return TRUE;
#include <gst/video/videooverlay.h>
#include <GL/gl.h>
-#include <GL/glu.h>
#include "pipeline.h"
Pipeline::Pipeline(const WId id, const QString videoLocation):
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- gluPerspective(45, (gfloat)width/(gfloat)height, 0.1, 100);
glMatrixMode(GL_MODELVIEW);
return TRUE;
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
- gluPerspective (45.0f, (GLfloat) width / (GLfloat) height, 0.1f, 100.0f);
glMatrixMode (GL_MODELVIEW);
}
#endif
#include <GL/gl.h>
-#include <GL/glu.h>
#include "SDL/SDL.h"
#include "SDL/SDL_opengl.h"
glMatrixMode (GL_PROJECTION);
glLoadIdentity (); // Reset The Projection Matrix
- gluPerspective (45.0f, (GLfloat) Width / (GLfloat) Height, 0.1f, 100.0f); // Calculate The Aspect Ratio Of The Window
-
glMatrixMode (GL_MODELVIEW);
}