From acde08228c4f84b715530fe8cefe0c7d94b6e4f0 Mon Sep 17 00:00:00 2001 From: bjorn Date: Mon, 14 Nov 2016 00:59:47 -0800 Subject: [PATCH] Bind texture after setting buffer; The `buffer` field was not being initialized to 0, so sometimes the texture was binding to the wrong target. --- src/graphics/texture.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/graphics/texture.c b/src/graphics/texture.c index 7759fe09..8687ca42 100644 --- a/src/graphics/texture.c +++ b/src/graphics/texture.c @@ -7,6 +7,7 @@ Texture* lovrTextureCreate(void* data, int size) { Texture* texture = malloc(sizeof(Texture)); if (!texture) return NULL; + texture->buffer = 0; glGenTextures(1, &texture->id); if (data) { @@ -24,8 +25,6 @@ Texture* lovrTextureCreate(void* data, int size) { free(image); } - texture->buffer = 0; - return texture; }