From 142411c08c23a81f1773a8f0a6abca6a851fb56c Mon Sep 17 00:00:00 2001 From: Themaister Date: Sun, 27 Mar 2011 20:33:14 +0200 Subject: [PATCH] Fix some garbage. --- gfx/gl.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gfx/gl.c b/gfx/gl.c index 7d39349807..403fcc0280 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -748,9 +748,12 @@ static bool gl_frame(void *data, const void* frame, unsigned width, unsigned hei glPixelStorei(GL_UNPACK_ALIGNMENT, get_alignment(pitch)); glPixelStorei(GL_UNPACK_ROW_LENGTH, gl->tex_w); - glTexImage2D(GL_TEXTURE_2D, - 0, GL_RGBA, gl->tex_w, gl->tex_h, 0, gl->texture_type, - gl->texture_fmt, NULL); + // Can we pass NULL here, hmm? + void *tmp = calloc(1, gl->tex_w * gl->tex_h * gl->base_size); + glTexSubImage2D(GL_TEXTURE_2D, + 0, 0, 0, gl->tex_w, gl->tex_h, gl->texture_type, + gl->texture_fmt, tmp); + free(tmp); GLfloat x = (GLfloat)width / gl->tex_w; GLfloat y = (GLfloat)height / gl->tex_h;