Filtered cloud texture to remove noise.

This commit is contained in:
Quantum 2013-11-09 17:38:01 -05:00
parent c0f4807d88
commit f15af40729
2 changed files with 4 additions and 2 deletions

View file

@ -143,7 +143,7 @@ class Applet(pyglet.window.Window):
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST) glHint(GL_LINE_SMOOTH_HINT, GL_NICEST)
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST) glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST)
glAlphaFunc(GL_GEQUAL, 0.9) glAlphaFunc(GL_GEQUAL, 0.2)
glDepthFunc(GL_LEQUAL) glDepthFunc(GL_LEQUAL)
glEnable(GL_DEPTH_TEST) glEnable(GL_DEPTH_TEST)
glShadeModel(GL_SMOOTH) glShadeModel(GL_SMOOTH)
@ -338,12 +338,14 @@ class Applet(pyglet.window.Window):
if self.cloud and hasattr(entity, 'cloudmap') and entity.cloudmap: if self.cloud and hasattr(entity, 'cloudmap') and entity.cloudmap:
glPushMatrix() glPushMatrix()
glEnable(GL_BLEND) glEnable(GL_BLEND)
glEnable(GL_ALPHA_TEST)
glTranslatef(*entity.location) glTranslatef(*entity.location)
pitch, yaw, roll = entity.rotation pitch, yaw, roll = entity.rotation
glRotatef(pitch, 1, 0, 0) glRotatef(pitch, 1, 0, 0)
glRotatef(yaw, 0, 1, 0) glRotatef(yaw, 0, 1, 0)
glRotatef(roll, 0, 0, 1) glRotatef(roll, 0, 0, 1)
glCallList(entity.cloudmap) glCallList(entity.cloudmap)
glDisable(GL_ALPHA_TEST)
glDisable(GL_BLEND) glDisable(GL_BLEND)
glPopMatrix() glPopMatrix()

View file

@ -250,7 +250,7 @@ def load_clouds(file):
glBindTexture(GL_TEXTURE_2D, id) 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_MAG_FILTER, filter)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_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)) glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, str(pixels))