本文整理汇总了C++中GstGLFuncs::BlendEquation方法的典型用法代码示例。如果您正苦于以下问题:C++ GstGLFuncs::BlendEquation方法的具体用法?C++ GstGLFuncs::BlendEquation怎么用?C++ GstGLFuncs::BlendEquation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GstGLFuncs
的用法示例。
在下文中一共展示了GstGLFuncs::BlendEquation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
//.........这里部分代码省略.........
-1.0, 1.0,-1.0f, 0.0f, 1.0f,
};
/* *INDENT-ON* */
frame = g_ptr_array_index (video_mixer->input_frames, count);
if (!frame) {
GST_DEBUG ("skipping texture, null frame");
count++;
continue;
}
pad = (GstGLVideoMixerPad *) frame->pad;
v_info = &GST_VIDEO_AGGREGATOR_PAD (pad)->info;
in_width = GST_VIDEO_INFO_WIDTH (v_info);
in_height = GST_VIDEO_INFO_HEIGHT (v_info);
if (!frame->texture || in_width <= 0 || in_height <= 0
|| pad->alpha == 0.0f) {
GST_DEBUG ("skipping texture:%u frame:%p width:%u height:%u alpha:%f",
frame->texture, frame, in_width, in_height, pad->alpha);
count++;
continue;
}
in_tex = frame->texture;
_init_vbo_indices (video_mixer);
if (pad->geometry_change || !pad->vertex_buffer) {
gint pad_width, pad_height;
gfloat w, h;
_mixer_pad_get_output_size (video_mixer, pad, &pad_width, &pad_height);
w = ((gfloat) pad_width / (gfloat) out_width);
h = ((gfloat) pad_height / (gfloat) out_height);
/* top-left */
v_vertices[0] = v_vertices[15] =
2.0f * (gfloat) pad->xpos / (gfloat) out_width - 1.0f;
/* bottom-left */
v_vertices[1] = v_vertices[6] =
2.0f * (gfloat) pad->ypos / (gfloat) out_height - 1.0f;
/* top-right */
v_vertices[5] = v_vertices[10] = v_vertices[0] + 2.0f * w;
/* bottom-right */
v_vertices[11] = v_vertices[16] = v_vertices[1] + 2.0f * h;
GST_TRACE ("processing texture:%u dimensions:%ux%u, at %f,%f %fx%f with "
"alpha:%f", in_tex, in_width, in_height, v_vertices[0], v_vertices[1],
v_vertices[5], v_vertices[11], pad->alpha);
if (!pad->vertex_buffer)
gl->GenBuffers (1, &pad->vertex_buffer);
gl->BindBuffer (GL_ARRAY_BUFFER, pad->vertex_buffer);
gl->BufferData (GL_ARRAY_BUFFER, 4 * 5 * sizeof (GLfloat), v_vertices,
GL_STATIC_DRAW);
pad->geometry_change = FALSE;
} else {
gl->BindBuffer (GL_ARRAY_BUFFER, pad->vertex_buffer);
}
gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, video_mixer->vbo_indices);
gl->BlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gl->BlendEquation (GL_FUNC_ADD);
gl->ActiveTexture (GL_TEXTURE0);
gl->BindTexture (GL_TEXTURE_2D, in_tex);
gst_gl_shader_set_uniform_1i (video_mixer->shader, "texture", 0);
gst_gl_shader_set_uniform_1f (video_mixer->shader, "alpha", pad->alpha);
gl->EnableVertexAttribArray (attr_position_loc);
gl->EnableVertexAttribArray (attr_texture_loc);
gl->VertexAttribPointer (attr_position_loc, 3, GL_FLOAT,
GL_FALSE, 5 * sizeof (GLfloat), (void *) 0);
gl->VertexAttribPointer (attr_texture_loc, 2, GL_FLOAT,
GL_FALSE, 5 * sizeof (GLfloat), (void *) (3 * sizeof (GLfloat)));
gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);
++count;
}
gl->DisableVertexAttribArray (attr_position_loc);
gl->DisableVertexAttribArray (attr_texture_loc);
if (gl->GenVertexArrays)
gl->BindVertexArray (0);
gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0);
gl->BindBuffer (GL_ARRAY_BUFFER, 0);
gl->BindTexture (GL_TEXTURE_2D, 0);
gl->Disable (GL_BLEND);
gst_gl_context_clear_shader (GST_GL_BASE_MIXER (mixer)->context);
}