From cc3fe078a6133d0337bc242db6af904f4647f6f3 Mon Sep 17 00:00:00 2001 From: Quantum Date: Sat, 26 Oct 2013 12:40:06 -0400 Subject: [PATCH] The author of the texture code, I mean the original, should know better how glTexImage2D works, because the GL documentation says otherwise. --- punyverse/texture.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/punyverse/texture.py b/punyverse/texture.py index db64fd1..561c378 100644 --- a/punyverse/texture.py +++ b/punyverse/texture.py @@ -188,14 +188,13 @@ def load_texture(file): print mode = GL_RGBA if 'A' in raw.format else GL_RGB - mode2 = mode # Flip from BGR to RGB # I hate you too, Pyglet... # REGULAR EXPRESSIONS ARE NOT MEANT TO PARSE BINARY DATA!!! #texture = raw.get_data('RGBA', width * 4) if safe else raw.data[::-1] if 'BGR' in raw.format else raw.data if raw.format in ('BGR', 'BGRA'): if bgra: - mode2 = {GL_RGBA: GL_BGRA, GL_RGB: GL_BGR}[mode] + mode = {GL_RGBA: GL_BGRA, GL_RGB: GL_BGR}[mode] texture = raw.data else: texture = bgr_to_rgb(raw.data, width, height, 'A' in raw.format) @@ -213,7 +212,7 @@ def load_texture(file): filter = GL_NEAREST if badcard else GL_LINEAR glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter) - gluBuild2DMipmaps(GL_TEXTURE_2D, len(raw.format), width, height, mode2, GL_UNSIGNED_BYTE, texture) + gluBuild2DMipmaps(GL_TEXTURE_2D, len(raw.format), width, height, mode, GL_UNSIGNED_BYTE, texture) cache[file] = id