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.
This commit is contained in:
Julien Isorce 2014-05-06 11:51:31 +01:00 committed by Tim-Philipp Müller
parent 88864ea2cc
commit 4bc96ae4cd

View 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);