From 4bc96ae4cdfd8356f611f7c98fbb397a7c53b2ca Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Tue, 6 May 2014 11:51:31 +0100 Subject: [PATCH] gl: allow to avoid calling glTexImage2D(w, h, NULL) when generating a texture Just pass 0 as width or height to gst_gl_context_gen_texture. --- gst-libs/gst/gl/gstglutils.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/gl/gstglutils.c b/gst-libs/gst/gl/gstglutils.c index 49769924cd..d5df84bf83 100644 --- a/gst-libs/gst/gl/gstglutils.c +++ b/gst-libs/gst/gl/gstglutils.c @@ -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);