当前位置: 首页>>代码示例>>C++>>正文


C++ GST_GL_FILTER函数代码示例

本文整理汇总了C++中GST_GL_FILTER函数的典型用法代码示例。如果您正苦于以下问题:C++ GST_GL_FILTER函数的具体用法?C++ GST_GL_FILTER怎么用?C++ GST_GL_FILTER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GST_GL_FILTER函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: gst_gl_effects_twirl_callback

static void
gst_gl_effects_twirl_callback (gint width, gint height, guint texture,
    gpointer data)
{
  GstGLShader *shader;
  GstGLEffects *effects = GST_GL_EFFECTS (data);
  GstGLFilter *filter = GST_GL_FILTER (effects);
  GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
  GstGLFuncs *gl = context->gl_vtable;

  shader = gst_gl_effects_get_fragment_shader (effects, "twirl",
      twirl_fragment_source_gles2);

  if (!shader)
    return;

#if GST_GL_HAVE_OPENGL
  if (USING_OPENGL (context)) {
    gl->MatrixMode (GL_PROJECTION);
    gl->LoadIdentity ();
  }
#endif

  gst_gl_shader_use (shader);

  gl->ActiveTexture (GL_TEXTURE0);
  gl->BindTexture (GL_TEXTURE_2D, texture);

  gst_gl_shader_set_uniform_1i (shader, "tex", 0);

  gst_gl_filter_draw_texture (filter, texture, width, height);
}
开发者ID:Haifen,项目名称:gst-plugins-bad,代码行数:32,代码来源:gstgleffecttwirl.c

示例2: gst_gl_differencematte_interp

static void
gst_gl_differencematte_interp (gint width, gint height, guint texture,
    gpointer stuff)
{
  GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (stuff);
  GstGLFilter *filter = GST_GL_FILTER (stuff);
  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;

  gst_gl_shader_use (differencematte->shader[3]);

  gl->ActiveTexture (GL_TEXTURE0);
  gl->BindTexture (GL_TEXTURE_2D, texture);

  gst_gl_shader_set_uniform_1i (differencematte->shader[3], "blend", 0);

  gl->ActiveTexture (GL_TEXTURE1);
  gl->BindTexture (GL_TEXTURE_2D, differencematte->newbgtexture);

  gst_gl_shader_set_uniform_1i (differencematte->shader[3], "base", 1);

  gl->ActiveTexture (GL_TEXTURE2);
  gl->BindTexture (GL_TEXTURE_2D, differencematte->midtexture[2]);

  gst_gl_shader_set_uniform_1i (differencematte->shader[3], "alpha", 2);

  gst_gl_filter_draw_texture (filter, texture, width, height);
}
开发者ID:Haifen,项目名称:gst-plugins-bad,代码行数:27,代码来源:gstgldifferencematte.c

示例3: gst_gl_effects_sobel_callback_vconv

static void
gst_gl_effects_sobel_callback_vconv (gint width, gint height, guint texture,
    gpointer data)
{
  GstGLShader *shader = NULL;
  GstGLEffects *effects = GST_GL_EFFECTS (data);
  GstGLFilter *filter = GST_GL_FILTER (effects);

  if (NULL != (shader = gst_gl_effects_get_fragment_shader (effects, "vconv0",
              sep_sobel_vconv3_fragment_source_gles2,
              sep_sobel_vconv3_fragment_source_opengl))) {
    GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;

#if GST_GL_HAVE_OPENGL
    if (USING_OPENGL (GST_GL_BASE_FILTER (filter)->context)) {
      gl->MatrixMode (GL_PROJECTION);
      gl->LoadIdentity ();
    }
#endif

    gst_gl_shader_use (shader);

    gl->ActiveTexture (GL_TEXTURE0);
    gl->BindTexture (GL_TEXTURE_2D, texture);

    gst_gl_shader_set_uniform_1i (shader, "tex", 0);
    gst_gl_shader_set_uniform_1f (shader, "height", height);

    gst_gl_filter_draw_texture (filter, texture, width, height);
  }
}
开发者ID:Distrotech,项目名称:gst-plugins-bad,代码行数:31,代码来源:gstgleffectsobel.c

示例4: init_pixbuf_texture

static void
init_pixbuf_texture (GstGLContext * context, gpointer data)
{
  GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (data);
  GstGLFilter *filter = GST_GL_FILTER (data);
  const GstGLFuncs *gl = context->gl_vtable;
  guint internal_format =
      gst_gl_sized_gl_format_from_gl_format_type (context, GL_RGBA,
      GL_UNSIGNED_BYTE);

  gl->DeleteTextures (1, &differencematte->newbgtexture);
  gl->GenTextures (1, &differencematte->newbgtexture);
  gl->BindTexture (GL_TEXTURE_2D, differencematte->newbgtexture);
  gl->TexImage2D (GL_TEXTURE_2D, 0, internal_format,
      (gint) differencematte->pbuf_width, (gint) differencematte->pbuf_height,
      0, GL_RGBA, GL_UNSIGNED_BYTE, differencematte->pixbuf);
  gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
  gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

  if (differencematte->savedbgtexture == 0) {
    gl->GenTextures (1, &differencematte->savedbgtexture);
    gl->BindTexture (GL_TEXTURE_2D, differencematte->savedbgtexture);
    gl->TexImage2D (GL_TEXTURE_2D, 0, internal_format,
        GST_VIDEO_INFO_WIDTH (&filter->out_info),
        GST_VIDEO_INFO_HEIGHT (&filter->out_info),
        0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
    gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
  }
}
开发者ID:Haifen,项目名称:gst-plugins-bad,代码行数:34,代码来源:gstgldifferencematte.c

示例5: gst_gl_filter_set_context

static void
gst_gl_filter_set_context (GstElement * element, GstContext * context)
{
  GstGLFilter *filter = GST_GL_FILTER (element);

  gst_gl_handle_set_context (element, context, &filter->display);
}
开发者ID:mapmapteam,项目名称:gst-plugins-gl,代码行数:7,代码来源:gstglfilter.c

示例6: gst_gl_filter_cube_filter_texture

static gboolean
gst_gl_filter_cube_filter_texture (GstGLFilter * filter, guint in_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 GST_GL_HAVE_GLES2
  if (api & GST_GL_API_GLES2)
    cb = _callback_gles2;
#endif

  /* blocking call, use a FBO */
  gst_gl_context_use_fbo (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);

  return TRUE;
}
开发者ID:Lachann,项目名称:gst-plugins-bad,代码行数:33,代码来源:gstglfiltercube.c

示例7: gst_gl_filter_query

static gboolean
gst_gl_filter_query (GstBaseTransform * trans, GstPadDirection direction,
    GstQuery * query)
{
  GstGLFilter *filter;
  gboolean res;

  filter = GST_GL_FILTER (trans);

  switch (GST_QUERY_TYPE (query)) {
    case GST_QUERY_CONTEXT:
    {
      res = gst_gl_handle_context_query ((GstElement *) filter, query,
          &filter->display);
      break;
    }
    default:
      res =
          GST_BASE_TRANSFORM_CLASS (parent_class)->query (trans, direction,
          query);
      break;
  }

  return res;
}
开发者ID:mapmapteam,项目名称:gst-plugins-gl,代码行数:25,代码来源:gstglfilter.c

示例8: gst_gl_overlay_callback

static void
gst_gl_overlay_callback (gint width, gint height, guint texture, gpointer stuff)
{
  GstGLOverlay *overlay = GST_GL_OVERLAY (stuff);
  GstGLFilter *filter = GST_GL_FILTER (overlay);
  const GstGLFuncs *gl = filter->context->gl_vtable;

  gl->MatrixMode (GL_PROJECTION);
  gl->LoadIdentity ();
  gluPerspective (70.0f,
      (GLfloat) overlay->width_window / (GLfloat) overlay->height_window, 1.0f,
      1000.0f);
  gl->Enable (GL_DEPTH_TEST);
  gluLookAt (0.0, 0.0, 0.01, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
  if (!overlay->video_top) {
    if (overlay->pbuftexture != 0)
      gst_gl_overlay_load_texture (overlay, overlay->pbuftexture, 0);
    // if (overlay->stretch) {
    //   width = (gfloat) overlay->width;
    //   height = (gfloat) overlay->height;
    // }
    gl->LoadIdentity ();
    gst_gl_overlay_load_texture (overlay, texture, 1);
  } else {
    gst_gl_overlay_load_texture (overlay, texture, 1);
    if (overlay->pbuftexture == 0)
      return;
    // if (overlay->stretch) {
    //   width = (gfloat) overlay->width;
    //   height = (gfloat) overlay->height;
    // }
    gl->LoadIdentity ();
    gst_gl_overlay_load_texture (overlay, overlay->pbuftexture, 0);
  }
}
开发者ID:asdlei00,项目名称:gst-plugins-bad,代码行数:35,代码来源:gstgloverlay.c

示例9: gst_gl_effects_xray

void
gst_gl_effects_xray (GstGLEffects * effects)
{
  GstGLFilter *filter = GST_GL_FILTER (effects);

  /* map luma to xray curve */
  gst_gl_filter_render_to_target (filter, effects->intexture,
      effects->midtexture[0], gst_gl_effects_xray_step_one, effects);
  /* horizontal blur */
  gst_gl_filter_render_to_target (filter, effects->midtexture[0],
      effects->midtexture[1], gst_gl_effects_xray_step_two, effects);
  /* vertical blur */
  gst_gl_filter_render_to_target (filter, effects->midtexture[1],
      effects->midtexture[2], gst_gl_effects_xray_step_three, effects);
  /* detect edges with Sobel */
  /* the old version used edges from the blurred texture, this uses
   * the ones from original texture, still not sure what I like
   * more. This one gives better edges obviously but behaves badly
   * with noise */
  /* desaturate */
  gst_gl_filter_render_to_target (filter, effects->intexture,
      effects->midtexture[3], gst_gl_effects_xray_desaturate, effects);
  /* horizonal convolution */
  gst_gl_filter_render_to_target (filter, effects->midtexture[3],
      effects->midtexture[4], gst_gl_effects_xray_sobel_hconv, effects);
  /* vertical convolution */
  gst_gl_filter_render_to_target (filter, effects->midtexture[4],
      effects->midtexture[3], gst_gl_effects_xray_sobel_vconv, effects);
  /* gradient length */
  gst_gl_filter_render_to_target (filter, effects->midtexture[3],
      effects->midtexture[4], gst_gl_effects_xray_sobel_length, effects);
  /* multiply edges with the blurred image */
  gst_gl_filter_render_to_target (filter, effects->midtexture[4],
      effects->outtexture, gst_gl_effects_xray_step_five, effects);
}
开发者ID:ChinnaSuhas,项目名称:ossbuild,代码行数:35,代码来源:gstgleffectxray.c

示例10: init_pixbuf_texture

static void
init_pixbuf_texture (GstGLContext * context, gpointer data)
{
  GstGLOverlay *overlay = GST_GL_OVERLAY (data);
  GstGLFilter *filter = GST_GL_FILTER (overlay);
  const GstGLFuncs *gl = filter->context->gl_vtable;

  if (overlay->pixbuf) {
    gl->DeleteTextures (1, &overlay->pbuftexture);
    gl->GenTextures (1, &overlay->pbuftexture);
    if (overlay->type_file == 1) {
      gl->BindTexture (GL_TEXTURE_2D, overlay->pbuftexture);
      gl->TexImage2D (GL_TEXTURE_2D, 0, GL_RGBA,
          (gint) overlay->width, (gint) overlay->height, 0,
          GL_RGBA, GL_UNSIGNED_BYTE, overlay->pixbuf);
    } else if (overlay->type_file == 2) {
      gl->BindTexture (GL_TEXTURE_2D, overlay->pbuftexture);
      gl->TexImage2D (GL_TEXTURE_2D, 0, overlay->internalFormat,
          overlay->width, overlay->height, 0, overlay->format,
          GL_UNSIGNED_BYTE, overlay->pixbuf);
      gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
      gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    }
  }
}
开发者ID:asdlei00,项目名称:gst-plugins-bad,代码行数:25,代码来源:gstgloverlay.c

示例11: gst_gl_differencematte_diff

static void
gst_gl_differencematte_diff (gint width, gint height, guint texture,
    gpointer stuff)
{
  GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (stuff);
  GstGLFilter *filter = GST_GL_FILTER (stuff);
  GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;

  gl->MatrixMode (GL_PROJECTION);
  gl->LoadIdentity ();

  gst_gl_shader_use (differencematte->shader[0]);

  gl->ActiveTexture (GL_TEXTURE0);
  gl->BindTexture (GL_TEXTURE_2D, texture);

  gst_gl_shader_set_uniform_1i (differencematte->shader[0], "current", 0);

  gl->ActiveTexture (GL_TEXTURE1);
  gl->BindTexture (GL_TEXTURE_2D, differencematte->savedbgtexture);

  gst_gl_shader_set_uniform_1i (differencematte->shader[0], "saved", 1);

  gst_gl_filter_draw_texture (filter, texture, width, height);
}
开发者ID:ndufresne,项目名称:gst-plugins-bad,代码行数:25,代码来源:gstgldifferencematte.c

示例12: init_pixbuf_texture

static void
init_pixbuf_texture (GstGLDisplay * display, gpointer data)
{
    GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (data);
    GstGLFilter *filter = GST_GL_FILTER (data);

    glDeleteTextures (1, &differencematte->newbgtexture);
    glGenTextures (1, &differencematte->newbgtexture);
    glBindTexture (GL_TEXTURE_RECTANGLE_ARB, differencematte->newbgtexture);
    glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA,
                  filter->width, filter->height, 0,
                  GL_RGBA, GL_UNSIGNED_BYTE, differencematte->pixbuf);

    if (differencematte->savedbgtexture == 0) {
        glGenTextures (1, &differencematte->savedbgtexture);
        glBindTexture (GL_TEXTURE_RECTANGLE_ARB, differencematte->savedbgtexture);
        glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA8,
                      filter->width, filter->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
        glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER,
                         GL_LINEAR);
        glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER,
                         GL_LINEAR);
        glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S,
                         GL_CLAMP_TO_EDGE);
        glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T,
                         GL_CLAMP_TO_EDGE);
    }
}
开发者ID:zsx,项目名称:ossbuild,代码行数:28,代码来源:gstgldifferencematte.c

示例13: gst_gl_effects_sobel

void
gst_gl_effects_sobel (GstGLEffects * effects)
{
  GstGLFilter *filter = GST_GL_FILTER (effects);
  GstGLShader *shader;

  shader = gst_gl_effects_get_fragment_shader (effects, "desat0",
      desaturate_fragment_source_gles2);
  gst_gl_filter_render_to_target_with_shader (filter, effects->intexture,
      effects->midtexture[0], shader);

  shader = gst_gl_effects_get_fragment_shader (effects, "hconv0",
      sep_sobel_hconv3_fragment_source_gles2);
  gst_gl_shader_use (shader);
  gst_gl_shader_set_uniform_1f (shader, "height",
      GST_VIDEO_INFO_HEIGHT (&filter->out_info));
  gst_gl_filter_render_to_target_with_shader (filter, effects->midtexture[0],
      effects->midtexture[1], shader);

  shader = gst_gl_effects_get_fragment_shader (effects, "vconv0",
      sep_sobel_vconv3_fragment_source_gles2);
  gst_gl_shader_use (shader);
  gst_gl_shader_set_uniform_1f (shader, "width",
      GST_VIDEO_INFO_WIDTH (&filter->out_info));
  gst_gl_filter_render_to_target_with_shader (filter, effects->midtexture[1],
      effects->midtexture[0], shader);

  shader = gst_gl_effects_get_fragment_shader (effects, "len0",
      sep_sobel_length_fragment_source_gles2);
  gst_gl_shader_use (shader);
  gst_gl_shader_set_uniform_1i (shader, "invert", effects->invert);
  gst_gl_filter_render_to_target_with_shader (filter, effects->midtexture[0],
      effects->outtexture, shader);
}
开发者ID:CogentEmbedded,项目名称:gst-plugins-bad,代码行数:34,代码来源:gstgleffectsobel.c

示例14: gst_gl_filter_start_gl

static void
gst_gl_filter_start_gl (GstGLContext * context, gpointer data)
{
  GstGLFilter *filter = GST_GL_FILTER (data);
  GstGLFilterClass *filter_class = GST_GL_FILTER_GET_CLASS (filter);

  filter_class->display_init_cb (filter);
}
开发者ID:mapmapteam,项目名称:gst-plugins-gl,代码行数:8,代码来源:gstglfilter.c

示例15: gst_gl_effects_squeeze

void
gst_gl_effects_squeeze (GstGLEffects * effects)
{
  GstGLFilter *filter = GST_GL_FILTER (effects);

  gst_gl_filter_render_to_target (filter, TRUE, effects->intexture,
      effects->outtexture, gst_gl_effects_squeeze_callback, effects);
}
开发者ID:Lachann,项目名称:gst-plugins-bad,代码行数:8,代码来源:gstgleffectsqueeze.c


注:本文中的GST_GL_FILTER函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。