From f15af40729b02c93a1fb1f9c449b24b2bdabb150 Mon Sep 17 00:00:00 2001 From: Quantum Date: Sat, 9 Nov 2013 17:38:01 -0500 Subject: [PATCH] Filtered cloud texture to remove noise. --- punyverse/game.py | 4 +++- punyverse/texture.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/punyverse/game.py b/punyverse/game.py index 5c3f5f9..519ba7f 100644 --- a/punyverse/game.py +++ b/punyverse/game.py @@ -143,7 +143,7 @@ class Applet(pyglet.window.Window): glHint(GL_LINE_SMOOTH_HINT, GL_NICEST) glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST) - glAlphaFunc(GL_GEQUAL, 0.9) + glAlphaFunc(GL_GEQUAL, 0.2) glDepthFunc(GL_LEQUAL) glEnable(GL_DEPTH_TEST) glShadeModel(GL_SMOOTH) @@ -338,12 +338,14 @@ class Applet(pyglet.window.Window): if self.cloud and hasattr(entity, 'cloudmap') and entity.cloudmap: glPushMatrix() glEnable(GL_BLEND) + glEnable(GL_ALPHA_TEST) glTranslatef(*entity.location) pitch, yaw, roll = entity.rotation glRotatef(pitch, 1, 0, 0) glRotatef(yaw, 0, 1, 0) glRotatef(roll, 0, 0, 1) glCallList(entity.cloudmap) + glDisable(GL_ALPHA_TEST) glDisable(GL_BLEND) glPopMatrix() diff --git a/punyverse/texture.py b/punyverse/texture.py index b114370..25d3c5b 100644 --- a/punyverse/texture.py +++ b/punyverse/texture.py @@ -250,7 +250,7 @@ def load_clouds(file): glBindTexture(GL_TEXTURE_2D, id) - filter = GL_NEAREST if badcard else GL_LINEAR + filter = GL_LINEAR glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter) glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, str(pixels))