gl/color: restore viewport dimensions when fbo done
authorJulien Isorce <julien.isorce@gmail.com>
Sat, 12 Apr 2014 23:21:00 +0000 (00:21 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 9 Dec 2017 19:31:36 +0000 (19:31 +0000)
Regression introduced by 95abfda1399bcddbee345d4542e857d743965477.
It caused to display the wrong frame size when resizing the window.

gst-libs/gst/gl/gstglcolorconvert.c

index 26d28d6..220b3f9 100644 (file)
@@ -1257,6 +1257,8 @@ _do_convert_draw (GstGLContext * context, GstGLColorConvert * convert)
   guint out_width, out_height;
   gint i;
 
+  GLint viewport_dim[4];
+
   const GLfloat vVertices[] = { 1.0f, -1.0f, 0.0f,
     1.0f, 0.0f,
     -1.0f, -1.0f, 0.0f,
@@ -1303,6 +1305,8 @@ _do_convert_draw (GstGLContext * context, GstGLColorConvert * convert)
   else if (gl->DrawBuffer)
     gl->DrawBuffer (GL_COLOR_ATTACHMENT0);
 
+  gl->GetIntegerv (GL_VIEWPORT, viewport_dim);
+
   gl->Viewport (0, 0, out_width, out_height);
 
   gl->ClearColor (0.0, 0.0, 0.0, 0.0);
@@ -1344,6 +1348,9 @@ _do_convert_draw (GstGLContext * context, GstGLColorConvert * convert)
   /* we are done with the shader */
   gst_gl_context_clear_shader (context);
 
+  gl->Viewport (viewport_dim[0], viewport_dim[1], viewport_dim[2],
+      viewport_dim[3]);
+
   gst_gl_context_check_framebuffer_status (context);
 
   gl->BindFramebuffer (GL_FRAMEBUFFER, 0);