From 15eab1ed0191f00ab9768156d3d2442a825651f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wang=20Xin-yu=20=28=E7=8E=8B=E6=98=95=E5=AE=87=29?= Date: Mon, 8 Dec 2014 11:02:51 +0800 Subject: [PATCH] glfilter: fix position/texcoord attrib index usage https://bugzilla.gnome.org/show_bug.cgi?id=741231 --- gst-libs/gst/gl/gstglfilter.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gst-libs/gst/gl/gstglfilter.c b/gst-libs/gst/gl/gstglfilter.c index 9ca6456d6b..19c509b077 100644 --- a/gst-libs/gst/gl/gstglfilter.c +++ b/gst-libs/gst/gl/gstglfilter.c @@ -299,6 +299,8 @@ gst_gl_filter_reset (GstGLFilter * filter) filter->fbo = 0; filter->depthbuffer = 0; filter->default_shader = NULL; + filter->draw_attr_position_loc = -1; + filter->draw_attr_texture_loc = -1; if (filter->other_context) gst_object_unref (filter->other_context); filter->other_context = NULL; @@ -1450,12 +1452,12 @@ _get_attributes (GstGLFilter * filter) if (!filter->default_shader) return; - if (!filter->draw_attr_position_loc) + if (filter->draw_attr_position_loc == -1) filter->draw_attr_position_loc = gst_gl_shader_get_attribute_location (filter->default_shader, "a_position"); - if (!filter->draw_attr_texture_loc) + if (filter->draw_attr_texture_loc == -1) filter->draw_attr_texture_loc = gst_gl_shader_get_attribute_location (filter->default_shader, "a_texcoord"); @@ -1504,6 +1506,7 @@ _bind_buffer (GstGLFilter * filter) gl->BindBuffer (GL_ARRAY_BUFFER, filter->vertex_buffer); + _get_attributes (filter); /* Load the vertex position */ gl->VertexAttribPointer (filter->draw_attr_position_loc, 3, GL_FLOAT, GL_FALSE, 5 * sizeof (GLfloat), (void *) 0); @@ -1512,7 +1515,6 @@ _bind_buffer (GstGLFilter * filter) gl->VertexAttribPointer (filter->draw_attr_texture_loc, 2, GL_FLOAT, GL_FALSE, 5 * sizeof (GLfloat), (void *) (3 * sizeof (GLfloat))); - _get_attributes (filter); gl->EnableVertexAttribArray (filter->draw_attr_position_loc); gl->EnableVertexAttribArray (filter->draw_attr_texture_loc);