本文整理汇总了C++中GST_GL_FILTER函数的典型用法代码示例。如果您正苦于以下问题:C++ GST_GL_FILTER函数的具体用法?C++ GST_GL_FILTER怎么用?C++ GST_GL_FILTER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GST_GL_FILTER函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: gst_gl_filter_stop_gl
static void
gst_gl_filter_stop_gl (GstGLDisplay * display, gpointer data)
{
GstGLFilter *filter = GST_GL_FILTER (data);
GstGLFilterClass *filter_class = GST_GL_FILTER_GET_CLASS (filter);
filter_class->display_reset_cb (filter);
}
开发者ID:zsx,项目名称:ossbuild,代码行数:8,代码来源:gstglfilter.c
示例17: gst_gl_effects_squeeze_callback
static void
gst_gl_effects_squeeze_callback (gint width, gint height, guint texture,
gpointer data)
{
GstGLShader *shader;
GstGLFilter *filter = GST_GL_FILTER (data);
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLContext *context = filter->context;
GstGLFuncs *gl = context->gl_vtable;
shader = g_hash_table_lookup (effects->shaderstable, "squeeze0");
if (!shader) {
shader = gst_gl_shader_new (context);
g_hash_table_insert (effects->shaderstable, (gchar *) "squeeze0", shader);
if (USING_GLES2 (context) || USING_OPENGL3 (context)) {
if (!gst_gl_shader_compile_with_default_v_and_check (shader,
squeeze_fragment_source_gles2, &filter->draw_attr_position_loc,
&filter->draw_attr_texture_loc)) {
/* gst gl context error is already set */
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
("Failed to initialize squeeze shader, %s",
gst_gl_context_get_error ()), (NULL));
return;
}
}
#if GST_GL_HAVE_OPENGL
if (USING_OPENGL (context)) {
if (!gst_gl_shader_compile_and_check (shader,
squeeze_fragment_source_opengl, GST_GL_SHADER_FRAGMENT_SOURCE)) {
gst_gl_context_set_error (context,
"Failed to initialize squeeze shader");
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
("%s", gst_gl_context_get_error ()), (NULL));
return;
}
}
#endif
}
#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);
if (USING_OPENGL (context))
gl->Enable (GL_TEXTURE_2D);
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:ego5710,项目名称:gst-plugins-bad,代码行数:58,代码来源:gstgleffectsqueeze.c
示例18: gst_gl_effects_xray_step_five
void
gst_gl_effects_xray_step_five (gint width, gint height, guint texture,
gpointer stuff)
{
GstGLEffects *effects = GST_GL_EFFECTS (stuff);
GstGLShader *shader;
shader = g_hash_table_lookup (effects->shaderstable, "xray4");
if (!shader) {
shader = gst_gl_shader_new ();
g_hash_table_insert (effects->shaderstable, "xray4", shader);
}
if (!gst_gl_shader_compile_and_check (shader,
multiply_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
gst_gl_display_set_error (GST_GL_FILTER (effects)->display,
"Failed to initialize multiply shader");
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
GST_GL_DISPLAY_ERR_MSG (GST_GL_FILTER (effects)->display), (NULL));
return;
}
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
gst_gl_shader_use (shader);
glActiveTexture (GL_TEXTURE2);
glEnable (GL_TEXTURE_RECTANGLE_ARB);
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, effects->midtexture[2]);
glDisable (GL_TEXTURE_RECTANGLE_ARB);
gst_gl_shader_set_uniform_1i (shader, "base", 2);
glActiveTexture (GL_TEXTURE1);
glEnable (GL_TEXTURE_RECTANGLE_ARB);
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, texture);
glDisable (GL_TEXTURE_RECTANGLE_ARB);
gst_gl_shader_set_uniform_1f (shader, "alpha", (gfloat) 0.5f);
gst_gl_shader_set_uniform_1i (shader, "blend", 1);
gst_gl_effects_draw_texture (effects, texture);
}
开发者ID:PeterXu,项目名称:gst-mobile,代码行数:45,代码来源:gstgleffectxray.c
示例19: gst_gl_effects_xray_step_two
static void
gst_gl_effects_xray_step_two (gint width, gint height, guint texture,
gpointer data)
{
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLShader *shader;
shader = g_hash_table_lookup (effects->shaderstable, "xray1");
if (!shader) {
shader = gst_gl_shader_new ();
g_hash_table_insert (effects->shaderstable, "xray1", shader);
}
if (!kernel_ready) {
fill_gaussian_kernel (gauss_kernel, 7, 1.5);
kernel_ready = TRUE;
}
if (!gst_gl_shader_compile_and_check (shader,
hconv7_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
gst_gl_display_set_error (GST_GL_FILTER (effects)->display,
"Failed to initialize hconv7 shader");
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
GST_GL_DISPLAY_ERR_MSG (GST_GL_FILTER (effects)->display), (NULL));
return;
}
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
gst_gl_shader_use (shader);
glActiveTexture (GL_TEXTURE1);
glEnable (GL_TEXTURE_RECTANGLE_ARB);
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, texture);
glDisable (GL_TEXTURE_RECTANGLE_ARB);
gst_gl_shader_set_uniform_1i (shader, "tex", 1);
gst_gl_shader_set_uniform_1fv (shader, "kernel", 9, gauss_kernel);
gst_gl_effects_draw_texture (effects, texture);
}
开发者ID:PeterXu,项目名称:gst-mobile,代码行数:43,代码来源:gstgleffectxray.c
示例20: gst_gl_filter_glass_callback
//opengl scene, params: input texture (not the output filter->texture)
static void
gst_gl_filter_glass_callback (gpointer stuff)
{
static gint64 start_time = 0;
gfloat rotation;
GstGLFilter *filter = GST_GL_FILTER (stuff);
GstGLFilterGlass *glass_filter = GST_GL_FILTER_GLASS (stuff);
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
gint width = GST_VIDEO_INFO_WIDTH (&filter->out_info);
gint height = GST_VIDEO_INFO_HEIGHT (&filter->out_info);
guint texture = glass_filter->in_tex;
if (start_time == 0)
start_time = get_time ();
else {
gint64 time_left =
(glass_filter->timestamp / 1000) - (get_time () - start_time);
time_left -= 1000000 / 25;
if (time_left > 2000) {
GST_LOG ("escape");
return;
}
}
gst_gl_shader_use (glass_filter->passthrough_shader);
gst_gl_filter_glass_draw_background_gradient (glass_filter);
//Rotation
if (start_time != 0) {
gint64 time_passed = get_time () - start_time;
rotation = sin (time_passed / 1200000.0) * 45.0f;
} else {
rotation = 0.0f;
}
gl->Enable (GL_BLEND);
gl->BlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gst_gl_shader_use (glass_filter->shader);
//Reflection
gst_gl_filter_glass_draw_video_plane (filter, width, height, texture,
0.0f, 2.0f, 0.3f, 0.0f, TRUE, rotation);
//Main video
gst_gl_filter_glass_draw_video_plane (filter, width, height, texture,
0.0f, 0.0f, 1.0f, 1.0f, FALSE, rotation);
gst_gl_context_clear_shader (GST_GL_BASE_FILTER (filter)->context);
gl->Disable (GL_BLEND);
}
开发者ID:Distrotech,项目名称:gst-plugins-bad,代码行数:56,代码来源:gstglfilterglass.c
注:本文中的GST_GL_FILTER函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论