/[gzz]/gzz/gfx/demo/opengl/mipmap.py
ViewVC logotype

Diff of /gzz/gfx/demo/opengl/mipmap.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by jvk, Mon Oct 21 08:39:01 2002 UTC revision 1.2 by tjl, Mon Oct 21 09:01:45 2002 UTC
# Line 6  tex.shade_all_levels(512, 512, 0, 4, "RG Line 6  tex.shade_all_levels(512, 512, 0, 4, "RG
6  class MipmapScene:  class MipmapScene:
7      def __init__(self):      def __init__(self):
8          self.scale = 256          self.scale = 256
9            self.height = 1.0
10            self.aniso = 1
11                    
12      def scene(self, vs):      def scene(self, vs):
13          putnoc(vs, background((0.4,0.4,0.9)))          putnoc(vs, background((0.4,0.4,0.9)))
14    
15          cs1 = vs.coords.affineCoordsys(0, 0, 512, 384, self.scale, 0, 0, self.scale)          cs1 = vs.coords.affineCoordsys(0, 0, 512, 384,
16                self.scale, 0, 0, self.scale * self.height)
17          vs.matcher.add(cs1, "1")          vs.matcher.add(cs1, "1")
18    
19            aniso = self.aniso
20    
21          texid = tex.getTexId()          texid = tex.getTexId()
22          vs.map.put(getDList("""          vs.map.put(getDList("""
23                    
24               BindTexture TEXTURE_2D %(texid)s               BindTexture TEXTURE_2D %(texid)s
25               TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR               TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR
26               TexParameter TEXTURE_2D TEXTURE_MAG_FILTER LINEAR               TexParameter TEXTURE_2D TEXTURE_MAG_FILTER LINEAR
27                 TexParameter TEXTURE_2D TEXTURE_MAX_ANISOTROPY_EXT %(aniso)s
28    
29               Enable BLEND               Enable BLEND
30               BlendFunc SRC_ALPHA ONE_MINUS_SRC_ALPHA               BlendFunc SRC_ALPHA ONE_MINUS_SRC_ALPHA
# Line 38  class MipmapScene: Line 44  class MipmapScene:
44      def key(self, k):      def key(self, k):
45          if k == "+": self.scale *= 1.2          if k == "+": self.scale *= 1.2
46          if k == "-": self.scale /= 1.2          if k == "-": self.scale /= 1.2
47            if k == "p": self.height *= 1.2 # flatten
48            if k == "o": self.height /= 1.2
49            if k == "a": self.aniso = 3 - self.aniso # toggle 1 <-> 2
50    
51  currentScene = MipmapScene()          currentScene = MipmapScene()        
52            

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26