gboolean geometry_change;
GLuint vertex_buffer;
+ gfloat m_matrix[16];
};
struct _GstGLVideoMixerPadClass
pad->blend_function_src_alpha = DEFAULT_PAD_BLEND_FUNCTION_SRC_ALPHA;
pad->blend_function_dst_rgb = DEFAULT_PAD_BLEND_FUNCTION_DST_RGB;
pad->blend_function_dst_alpha = DEFAULT_PAD_BLEND_FUNCTION_DST_ALPHA;
+ memset(pad->m_matrix, 0, sizeof(gfloat) * 4 * 4);
+ pad->m_matrix[0] = 1.0;
+ pad->m_matrix[5] = 1.0;
+ pad->m_matrix[10] = 1.0;
+ pad->m_matrix[15] = 1.0;
}
static void
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;
+ pad->m_matrix[0] = w;
+ pad->m_matrix[5] = h;
+ pad->m_matrix[12] = (gfloat) pad->xpos / (gfloat) out_width;
+ pad->m_matrix[13] = (gfloat) pad->ypos / (gfloat) out_height;
+
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);
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);
{
GstVideoAffineTransformationMeta *af_meta;
gfloat matrix[16];
+ gfloat af_matrix[16];
GstBuffer *buffer =
gst_video_aggregator_pad_get_current_buffer (vagg_pad);
af_meta = gst_buffer_get_video_affine_transformation_meta (buffer);
- gst_gl_get_affine_transformation_meta_as_ndc_ext (af_meta, matrix);
+ gst_gl_get_affine_transformation_meta_as_ndc_ext (af_meta, af_matrix);
+ gst_gl_multiply_matrix4(af_matrix, pad->m_matrix, matrix);
gst_gl_shader_set_uniform_matrix_4fv (video_mixer->shader,
"u_transformation", 1, FALSE, matrix);
}