gl: allow to avoid calling glTexImage2D(w, h, NULL) when generating a texture
authorJulien Isorce <julien.isorce@collabora.co.uk>
Tue, 6 May 2014 10:51:31 +0000 (11:51 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 9 Dec 2017 19:31:39 +0000 (19:31 +0000)
Just pass 0 as width or height to gst_gl_context_gen_texture.

gst-libs/gst/gl/gstglutils.c

index 4976992..d5df84b 100644 (file)
@@ -111,8 +111,10 @@ _gen_texture (GstGLContext * context, GenTexture * data)
 
   gl->GenTextures (1, &data->result);
   gl->BindTexture (GL_TEXTURE_2D, data->result);
-  gl->TexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, data->width,
-      data->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+
+  if (data->width > 0 && data->height > 0)
+    gl->TexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, data->width,
+        data->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
 
   gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
   gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);