gl: fix assignment of temporary variables

This commit is contained in:
Matthew Waters 2014-04-02 22:43:41 +11:00 committed by Tim-Philipp Müller
parent 71548893bf
commit b70069bc61
2 changed files with 45 additions and 77 deletions

View file

@ -250,7 +250,40 @@ gst_gl_mosaic_callback (gpointer stuff)
while (count < mosaic->input_frames->len && count < 6) { while (count < mosaic->input_frames->len && count < 6) {
GstGLMixerFrameData *frame; GstGLMixerFrameData *frame;
GLfloat *v_vertices; /* *INDENT-OFF* */
gfloat v_vertices = {
/* front face */
1.0f, 1.0f,-1.0f, 1.0f, 0.0f,
1.0f,-1.0f,-1.0f, 1.0f, 1.0f,
-1.0f,-1.0f,-1.0f, 0.0f, 1.0f,
-1.0f, 1.0f,-1.0f, 0.0f, 0.0f,
/* right face */
1.0f, 1.0f, 1.0f, 1.0f, 0.0f,
1.0f,-1.0f, 1.0f, 0.0f, 0.0f,
1.0f,-1.0f,-1.0f, 0.0f, 1.0f,
1.0f, 1.0f,-1.0f, 1.0f, 1.0f,
/* left face */
-1.0f, 1.0f, 1.0f, 1.0f, 0.0f,
-1.0f, 1.0f,-1.0f, 1.0f, 1.0f,
-1.0f,-1.0f,-1.0f, 0.0f, 1.0f,
-1.0f,-1.0f, 1.0f, 0.0f, 0.0f,
/* top face */
1.0f,-1.0f, 1.0f, 1.0f, 0.0f,
-1.0f,-1.0f, 1.0f, 0.0f, 0.0f,
-1.0f,-1.0f,-1.0f, 0.0f, 1.0f,
1.0f,-1.0f,-1.0f, 1.0f, 1.0f,
/* bottom face */
1.0f, 1.0f, 1.0f, 1.0f, 0.0f,
1.0f, 1.0f,-1.0f, 1.0f, 1.0f,
-1.0f, 1.0f,-1.0f, 0.0f, 1.0f,
-1.0f, 1.0f, 1.0f, 0.0f, 0.0f,
/* back face */
1.0f, 1.0f, 1.0f, 1.0f, 0.0f,
-1.0f, 1.0f, 1.0f, 0.0f, 0.0f,
-1.0f,-1.0f, 1.0f, 0.0f, 1.0f,
1.0f,-1.0f, 1.0f, 1.0f, 1.0f
};
/* *INDENT-ON* */
guint in_tex; guint in_tex;
guint width, height; guint width, height;
@ -268,65 +301,6 @@ gst_gl_mosaic_callback (gpointer stuff)
GST_TRACE ("processing texture:%u dimensions:%ux%u", in_tex, width, height); GST_TRACE ("processing texture:%u dimensions:%ux%u", in_tex, width, height);
/* *INDENT-OFF* */
v_vertices = (GLfloat[]) {
/* front face */
1.0f, 1.0f, -1.0f,
1.0f, 0.0f,
1.0f, -1.0f, -1.0f,
1.0f, 1.0f,
-1.0f, -1.0f, -1.0f,
0.0f, 1.0f,
-1.0f, 1.0f, -1.0f,
0.0f, 0.0f,
/* right face */
1.0f, 1.0f, 1.0f,
1.0f, 0.0f,
1.0f, -1.0f, 1.0f,
0.0f, 0.0f,
1.0f, -1.0f, -1.0f,
0.0f, 1.0f,
1.0f, 1.0f, -1.0f,
1.0f, 1.0f,
/* left face */
-1.0f, 1.0f, 1.0f,
1.0f, 0.0f,
-1.0f, 1.0f, -1.0f,
1.0f, 1.0f,
-1.0f, -1.0f, -1.0f,
0.0f, 1.0f,
-1.0f, -1.0f, 1.0f,
0.0f, 0.0f,
/* top face */
1.0f, -1.0f, 1.0f,
1.0f, 0.0f,
-1.0f, -1.0f, 1.0f,
0.0f, 0.0f,
-1.0f, -1.0f, -1.0f,
0.0f, 1.0f,
1.0f, -1.0f, -1.0f,
1.0f, 1.0f,
/* bottom face */
1.0f, 1.0f, 1.0f,
1.0f, 0.0f,
1.0f, 1.0f, -1.0f,
1.0f, 1.0f,
-1.0f, 1.0f, -1.0f,
0.0f, 1.0f,
-1.0f, 1.0f, 1.0f,
0.0f, 0.0f,
/* back face */
1.0f, 1.0f, 1.0f,
1.0f, 0.0f,
-1.0f, 1.0f, 1.0f,
0.0f, 0.0f,
-1.0f, -1.0f, 1.0f,
0.0f, 1.0f,
1.0f, -1.0f, 1.0f,
1.0f, 1.0f
};
/* *INDENT-ON* */
gl->VertexAttribPointer (attr_position_loc, 3, GL_FLOAT, gl->VertexAttribPointer (attr_position_loc, 3, GL_FLOAT,
GL_FALSE, 5 * sizeof (GLfloat), &v_vertices[5 * 4 * count]); GL_FALSE, 5 * sizeof (GLfloat), &v_vertices[5 * 4 * count]);

View file

@ -221,22 +221,30 @@ gst_gl_video_mixer_callback (gpointer stuff)
while (count < video_mixer->input_frames->len) { while (count < video_mixer->input_frames->len) {
GstGLMixerFrameData *frame; GstGLMixerFrameData *frame;
GLfloat *v_vertices; /* *INDENT-OFF* */
gfloat v_vertices = {
/* front face */
-1.0,-1.0,-1.0f, 0.0f, 0.0f,
1.0,-1.0,-1.0f, 1.0f, 0.0f,
1.0, 1.0,-1.0f, 1.0f, 1.0f,
-1.0, 1.0,-1.0f, 0.0f, 1.0f,
};
/* *INDENT-ON* */
guint in_tex; guint in_tex;
guint in_width, in_height; guint in_width, in_height;
gfloat w, h; gfloat w, h;
frame = g_ptr_array_index (video_mixer->input_frames, count); frame = g_ptr_array_index (video_mixer->input_frames, count);
in_tex = frame->texture;
in_width = GST_VIDEO_INFO_WIDTH (&frame->pad->in_info); in_width = GST_VIDEO_INFO_WIDTH (&frame->pad->in_info);
in_height = GST_VIDEO_INFO_HEIGHT (&frame->pad->in_info); in_height = GST_VIDEO_INFO_HEIGHT (&frame->pad->in_info);
if (!frame || !in_tex || in_width <= 0 || in_height <= 0) { if (!frame || !frame->texture || in_width <= 0 || in_height <= 0) {
GST_DEBUG ("skipping texture:%u frame:%p width:%u height %u", GST_DEBUG ("skipping texture:%u frame:%p width:%u height %u",
in_tex, frame, in_width, in_height); in_tex, frame, in_width, in_height);
count++; count++;
continue; continue;
} }
in_tex = frame->texture;
GST_TRACE ("processing texture:%u dimensions:%ux%u", in_tex, in_width, GST_TRACE ("processing texture:%u dimensions:%ux%u", in_tex, in_width,
in_height); in_height);
@ -246,20 +254,6 @@ gst_gl_video_mixer_callback (gpointer stuff)
GST_TRACE ("processing texture:%u dimensions:%ux%u, %fx%f", in_tex, GST_TRACE ("processing texture:%u dimensions:%ux%u, %fx%f", in_tex,
in_width, in_height, w, h); in_width, in_height, w, h);
/* *INDENT-OFF* */
v_vertices = (GLfloat[]) {
/* front face */
-1.0, -1.0, -1.0f,
0.0f, 0.0f,
1.0, -1.0, -1.0f,
1.0f, 0.0f,
1.0, 1.0, -1.0f,
1.0f, 1.0f,
-1.0, 1.0, -1.0f,
0.0f, 1.0f,
};
/* *INDENT-ON* */
gl->VertexAttribPointer (attr_position_loc, 3, GL_FLOAT, gl->VertexAttribPointer (attr_position_loc, 3, GL_FLOAT,
GL_FALSE, 5 * sizeof (GLfloat), &v_vertices[0]); GL_FALSE, 5 * sizeof (GLfloat), &v_vertices[0]);